我正在使用Excel-vba,並試圖獲取InternetExplorer對象的innerHTML,我的問題是點擊鏈接後,innerHTML不會更改,並保持爲第一個導航。IE點擊鏈接後的innerHTML
有沒有辦法在點擊鏈接後獲取下一頁的innerHTML? 下面是代碼:
Dim ie As InternetExplorer
Dim hd As HTMLDocument
Set ie = New InternetExplorer
ie.navigate "http://www.stormchaser.niu.edu/machine/textfcstsound.html"
Do While ie.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
Set hd = ie.document
hd.all.Item("mo")(4).Checked = True
hd.all.Item("ft")(11).Checked = True
Set objInputs = ie.document.getElementsByTagName("input")
For Each ele In objInputs
If ele.Type = "submit" Then
ele.Click
End If
Next
Do While ie.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
hd.Links(0).Click
Range("K4") = ie.document.body.innerHTML
我真的感謝您的幫助。
喬恩
你試過在點擊後等待就緒狀態? – Thorarins
是的,我以後試過,但沒有任何事發生 – Jon777