1
我正在學習如何從Internet Explorer中提取源數據。我已經學會了如何從YouTube編碼。但是,當我想修改它來測試另一個網站時,我遇到了一個錯誤。任何人都可以提醒一下嗎?從Internet Explorer獲取數據
測試網站:http://www.oxforddictionaries.com
Sub clickFormbutton()
Dim ie As Object
Dim form As Variant, button As Variant
Set ie = CreateObject("InternetExplorer.Application")
input1 = InputBox("Please enter keyword.")
With ie
.Visible = True
.navigate ("http://www.oxforddictionaries.com")
While ie.ReadyState <> 4
DoEvents
Wend
ie.document.getelementsbyname("q").Item.innertext = input1
Set form = ie.document.getElementsbytagname("form")
Set button = form(0).onsubmit
form(0).submit
Do While ie.busy: DoEvents: Loop
Set TDelements = .document.getElementsbytagname("td")
r = 0
c = 0
For Each TDelement In TDelements
Sheet1.Range("A1").Offset(r, c).Value = TDelement.innertext
r = r + 1
Next
End With
Set ie = Nothing
End Sub
你能告訴我們錯誤是什麼嗎?請編輯您的問題幷包含錯誤。 –
錯誤是運行時錯誤'91':對象變量或未設置塊變量 – user3045580