VBA Internet Explorer自动化错误 [英] VBA Internet explorer Automation error
本文介绍了VBA Internet Explorer自动化错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图建立一个公共测试环境,看看是否有人能够帮助我解决我今天早上提出的另一个问题而且我收到了这个错误,我在原始代码中没有得到这个错误我无法修复:自动化错误 - 调用的对象已与其客户端断开连接。
I was trying to set up a public test environment to see if anyone would be able to help me with another question I asked this morning and I'm getting this error which I was not getting in my original code and after browsing a bit around I cannot fix: Automation error - The object invoked has disconnected from its clients.
以下是完整代码:
Sub GetBranches()
Dim objIE As InternetExplorer
Set objIE = New InternetExplorerMedium ' create new browser
objIE.Visible = True
objIE.navigate "https://casadasereia.net/vbatests/viewtree241653.html"
' wait for browser
Do While objIE.Busy = True Or objIE.readyState <> 4
DoEvents
Loop
End Sub
任何人都知道如何解决这个问题?
Anyone knows how to fix this?
推荐答案
使用后期绑定来避免对库的额外引用,这将解决版本问题(如果有的话)。
Use late-binding to avoid additional reference to a library and this will fix versioning issues if any.
Sub GetBranches()
Dim objIE as Object
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.navigate "https://casadasereia.net/vbatests/viewtree241653.html"
' wait for browser
Do While objIE.Busy = True Or objIE.readyState <> 4
DoEvents
Loop
End Sub
这篇关于VBA Internet Explorer自动化错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文