但是得到错误:
当我将光标移动到“ObjResult5”时单击Debug后,它显示ObjResult5 =“Nothing”
我的宏:
Sub getDataIE_Basic()
Dim totalResults As Long
Dim RowBasic As Long
totalResults = 2-1
RowBasic = 2
Set Sheet_OutputBasic = Worksheets("Output - Basic Data")
Set objIEBrowser = CreateObject("InternetExplorer.Application")
objIEBrowser.Visible = True
Dim url As String
url = "https://search.rpxcorp.com/advanced_search/search_litigations#grouped=false&searchq=%221%3A2015-cv-00014%22&page=1&sub_page=1"
objIEBrowser.navigate url
Do
DoEvents
Loop Until objIEBrowser.readyState = READYSTATE_COMPLETE
Call FnWait(5)
Set Doc = objIEBrowser.document
For Results = 0 To totalResults
Set objResultMain = Doc.getElementById("search_results_replaced_content")
Set objResult = objResultMain.getElementsByTagName("Div")(0)
Set objResult2 = objResult.getElementsByTagName("Div")(1)
Set objResult3 = objResult2.getElementsByTagName("Div")(2)
Set objResult4 = objResult3.getElementsByTagName("Div")(1)
Set objResult5 = objResult4.getElementsByTagName("table")(0)
Set objResult6 = objResult5.getElementsByTagName("tbody")(0)
Set objResult7 = objResult6.getElementsByTagName("tr")(0)
FileDate = objResult7.getElementsByTagName("td")(0).innerText
CaseName = objResult7.getElementsByTagName("td")(1).innerText
CaseNo = objResult7.getElementsByTagName("td")(2).innerText
FilJurisdiction = objResult7.getElementsByTagName("td")(3).innerText
Status = objResult7.getElementsByTagName("td")(4).innerText
Sheet_OutputBasic.Cells(RowBasic, 1) = FileDate
Sheet_OutputBasic.Cells(RowBasic, 2) = CaseName
Sheet_OutputBasic.Cells(RowBasic, 3) = CaseNo
Sheet_OutputBasic.Cells(RowBasic, 4) = FilJurisdiction
Sheet_OutputBasic.Cells(RowBasic, 5) = Status
RowBasic = RowBasic + 1
Next Results
End Sub
Function FnWait(intTime)
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + intTime
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
End Function
如何解决此问题?