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