在同一行上出現兩個不同的錯誤。有時,這一個:獲取InternetExplorer對象的ReadyState時出現自動化錯誤
Automation error: object invoked has disconnected from its clients
有時:
the interface is unknown
最少的代碼來重現錯誤:
Sub mcve()
Dim ie As Object
Dim www As String
Set ie = New InternetExplorerMedium
www = "http://www.stackoverflow.com"
ie.navigate www
ie.Visible = False
While ie.ReadyState <> 4 ' <~~~~~~~~~~~~~~~~~~~~~~~~ Error occurs here
DoEvents
Wend
End Sub
這需要一個參考:工具>參考...> Microsoft Internet控制
第二次出現While ie.ReadyState <> 4
錯誤。我該如何解決?