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
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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