Macro to open IE page but not if its already open.

nbraybrook

New Member
Joined
Aug 3, 2011
Messages
7
Hi experts!
Here is what I am trying to do. I have a button on my excel sheet to take the user to the time sheet system which is html based. They click the button it will take them to the time sheet interface in IE. But alot of users leave the time sheet window open in IE. So what I want my macro to do is if that page is already open then just bring that ie window to the front, if its not then open ie and take you to that page. I am currently trying the code below problem is even time I click the button it is opening a new tab of the same page in IE if IE is already open. I just want it to not open a new tab if IE is already open

Code:
Sub GetIE_LateBinding()
  
  Dim IE As Object
  
  With CreateObject("Shell.Application").Windows
    
    If .count > 0 Then
      ' Get IE
      Set IE = .Item(0) ' or .Item(.Count - 1)
    Else
      ' Create IE
      Set IE = CreateObject("InternetExplorer.Application")
      IE.Visible = True
    End If
  
    IE.Navigate "http://timesheetaddyhere/"
  
    Set IE = Nothing
  
  End With
  
End Sub


[FONT=Courier New][COLOR=darkblue]
[/COLOR][/FONT]
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,224,568
Messages
6,179,595
Members
452,927
Latest member
whitfieldcraig

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