VBA: Opening invisible Internet Explorer object doesn't work

billiboy

Board Regular
Joined
Jul 16, 2008
Messages
55
Hi,

The below macro should open an invisible Internet Explorer window and then close it. I have 4 computers but the macro only runs on 2 of them.

Code:
Sub Test()
    Dim IE As Object
    Set IE = CreateObject("InternetExplorer.Application")
 
    With IE
        .Visible = False
        .Navigate "[URL]http://www.wmcompany.com/wmr/CurrencyConverter/index.htm[/URL]"
        Do Until .ReadyState = 4: DoEvents: Loop
        .Quit
    End With
    Debug.Print "Finito"
End Sub

On the computers where the macro doesn't work, a visible Internet Explorer window is opened (even though I've written .Visible = False) and I get an error message at the "Do Until.. " line. The error message reads:

"Automation Error The object invoked has disconnected from its clients"

Do anyone know what can be the problem? All of my computers run Excel 2007, Internet Explorer 8 and Windows Vista Business SP2.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Can somebody please copy my above macro and see if it works for you? It doesn't need to navigate to the www.wmcompany.com website, any website will do. I just want to know if others experience the same problem.
 
Upvote 0
Problem solved! I found out that the computers on which the macro didn't run had Internet Explorer 7 (I had foolishly assumed that they ran IE8). After upgrading to IE8 the macro runs.
 
Upvote 0

Forum statistics

Threads
1,215,603
Messages
6,125,786
Members
449,259
Latest member
rehanahmadawan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top