VBA - Bring Internet Explorer Window to the front when Workbook is opened

MoBo

New Member
Joined
Jan 2, 2013
Messages
11
I'm trying to use VBA script to run and use IE when Workbook is opened. I wrote following code, but IE window stays behind Excel window (only flashing in taskbar).
I'm using Office 2010 (32 bit) on Windows 7 (64 bit).

"Workbook_open" part of the code
Code:
Sub Workbook_Open()

    Application.OnTime Now + TimeValue("00:00:02"), "Auto_run"

End Sub

"Module1" part of the code
Code:
Sub Auto_run()

    Dim IE As Object

    Set IE = CreateObject("InternetExplorer.Application")

    ' Set IE parameters
    IE.Top = 80
    IE.Left = 600
    IE.Width = 1300
    IE.Height = 900
    IE.AddressBar = 0
    IE.StatusBar = 0
    IE.Toolbar = 0

    ' Load URL
    IE.Navigate ("http://www.google.com")

    ' Waiting for a page to load
    While IE.Busy
    DoEvents
    Wend

    ' Make IE visible
    IE.Visible = True

End Sub
 

Some videos you may like

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Watch MrExcel Video

Forum statistics

Threads
1,123,366
Messages
5,601,204
Members
414,434
Latest member
Riyen

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
Top