Automation error: the invoked object disconnected from its clients

All I did was copy-paste the code snippet that worked fine in another section of my new sub and changed the url I wanted to use. The first substream is still running, while the second is not. I am very confused.

Dim ie As InternetExplorer              
Dim html As HTMLDocument                 
Set ie = New InternetExplorer            
ie.Visible = False                       
ie.navigate "http://cesp.hma.eu/Contacts" 
With ie                                  
    Do Until .READYSTATE = 4: DoEvents: Loop
    Do While .Busy: DoEvents: Loop
End With
Set html = ie.document             
Set ie = Nothing                   
Application.StatusBar = ""  

      

Using F8 to inspect the code step by step, the url seems to be ignoring ie.Visible = False

(it opens when I reach With ie

) and then the error message appearsDo While .Busy: DoEvents: Loop

I honestly don't know where to start looking for this because I literally only changed the url and nothing else. My best bet was to just close my book and reopen it, but the problem decided to persist. Any hints, explanations or solutions you can think of would be greatly appreciated.

+3


source to share


2 answers


This is probably due to the security settings in IE. As suggested by @ Vigneshts88 here , try changing

Set ie = New InternetExplorer 

      

in



Set ie = New InternetExplorerMedium

      

As noted by @Mike in a comment in the answer above, InternetExplorerMedium

requires a link toMicrosoft Internet Controls

+4


source


Yeah baby!

Set ie = New InternetExplorerMedium



Fixed it for me!

Can't wait for this stuff to work.

0


source







All Articles