我是一名VBA新手,也是Stack Overflow的新手,儘管我一直在這裏閱讀帖子一段時間。我已經搜索了很多關於我的編碼問題的答案,但我似乎無法找到答案。我試圖登錄到一個網站,導航到一個頁面,然後從該頁面中抓取數據。我已經開始構建我在互聯網上找到的代碼。我似乎無法讓IE瀏覽器在使用「獲取元素」查找其ID後,將我的憑證放入適當的用戶和密碼箱中。結果是運行時錯誤424 - 對象必需。預先感謝您的幫助。Excel VBA登錄IE網站
'Open IE, navigate to the desired page and loop until fully loaded
Set IE = CreateObject("InternetExplorer.Application")
site = "https://www.ivolatility.com/login.j"
With IE
.Visible = True
.navigate site
Do Until Not IE.Busy And IE.readyState = 4
DoEvents
Loop
End With
'Input the userid and password
IE.Document.getElementById("username").Value = "xxxxxx"
IE.Document.getElementById("password").Value = "xxxxxx"
'Click the "Search" button
IE.Document.getElementById("login_go").Click
Do Until Not IE.Busy And IE.readyState = 4
DoEvents
Loop
這些元素沒有這樣的ID。 –