AppActivate for IE not working

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
 
G

Gary''s Student

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
 
G

Gary''s Student

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top