【发布时间】:2016-09-05 22:39:34
【问题描述】:
我想退回交货日期 Thu 3/31/2016 12:16 pm
这是我目前的代码
Public Sub FedExTracking()
Dim IE As Object
Dim ReturnValue As Object
Dim ProUrl As String
Dim RowCount As Integer
Dim PullText As String
Dim iCounter As Integer
Set IE = CreateObject("InternetExplorer.application")
RowCount = 0
Do While Not ActiveCell.Offset(RowCount, -1).Value = ""
ProUrl = "https://www.fedex.com/apps/fedextrack/?action=track&tracknumbers=" & ActiveCell.Offset(RowCount, -1).Value & "&locale=en_US&cntry_code=us"
With IE
.Visible = True
.Navigate ProUrl
Do Until Not IE.Busy And IE.readyState = 4: DoEvents: Loop
End With
iCounter = 0
Do While iCounter < 8
WaitHalfSec
iCounter = iCounter + 1
Loop
set ReturnValue = IE.document.getElementsClassName("snapshotController_date.dest")(0)
'THIS LINE RETURNS RUN TIME ERROR "91" OBJECT VARIABLE OR WITH BLOCK VARIABLE NOT SET
PullText = ReturnValue.innertext
ActiveCell.Offset(RowCount).Value = PullText & "."
RowCount = RowCount + 1
Loop
IE.Quit
Set IE = Nothing
End Sub
Sub WaitHalfSec()
Dim t As Single
t = Timer + 1 / 2
Do Until t < Timer: DoEvents: Loop
End Sub
只要我不想进入内部文本,我就能够找到并存储似乎的行。我将如何在这条线上返回日期?
2016 年 3 月 31 日星期四下午 12:16
感谢任何帮助!