0
Sub Autologin()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "my_url"
IE.Document.GetElementByID("j_username").Value = "my_username"`
錯誤發生在最後一行。VBA - IE自動化
Error: Run-time error '-2147417848 (80010108)':
Automation error, The object invoked has disconnected from its client.
我發現這個代碼能夠在我的家裏筆記本電腦上運行,但不是我的工作筆記本電腦。有誰知道如何解決這個問題?由於
這聽起來有點幼稚,但是您的工作筆記本電腦上是否安裝了Internet Explorer? – RCaetano
是的。該URL可以在Internet Explorer中正常打開,但不會在用戶名框中輸入任何內容,並且會顯示錯誤消息。謝謝 – darrenvba
這可能是因爲我缺乏知識,但是您是否想要'GetElementByID'併爲其分配一個值?它認爲'GetElementByID'返回一個對象?它如何分配一個值?那麼你是不是捕獲什麼被返回? – Zac