AppActivate for IE not working

  • Thread starter Thread starter Barb Reinhardt
  • Start date Start date
B

Barb Reinhardt

I'm trying to use AppActivate for IE and it's intermittently working. I've
got things dimensioned as follows

Dim myIE As SHDocVw.InternetExplorer

How do I activate the IE window so that it works all of the time?

Thanks,
Barb Reinhardt
 
Here is some typical code that:

1. creates an IE object
2. does some simple tailoring
3. opens CNN
4. returns to the worksheet
5. allows the refresh of the website

Sub Launch_IE()

Set ie = CreateObject("InternetExplorer.Application")
ie.AddressBar = False
ie.MenuBar = False
ie.Toolbar = False
ie.Width = 610
ie.Height = 700
ie.Left = 0
ie.Top = 0
ie.navigate "http://www.cnn.com"

ie.resizable = True
ie.Visible = True
ActiveSheet.Activate
MsgBox ("ready to refresh??")
AppActivate ie
SendKeys "{F5}"
DoEvents
End Sub
 
In my little demo, once IE has been activated, I wanted to refresh the page.

The SendKeys is like touching the F5 key in IE (it refreshes the window).
The DoEvents gives focus back to IE to accept this keystroke.
 
Back
Top