PDA

View Full Version : VBA check if IE 10 is running / Open



nhmabv
08-10-2013, 01:55 PM
I am running Office 2003 , MS word VBA on win 7

I need to test to see if IE (Ver 10) is running. If so I need to activate and show a window and ask a question to the user "Is this the application bla bla bla...." and get the full title name (which has the users real name).
If IE is running and there are no other tabs open that have the focus the following works:

For Each Task1 In Tasks
If InStr(Task1.name, "Outlook Web App - Windows Internet Explorer") > 0 Then
Task1.Activate 'Line nn fails here

Ans = APIMsgBox(prompt:=C1 & "Is this The abc company E-Mail Outlook Application???", buttons:=vbYesNo + vbSystemModal, title:=Task1.name)

If Ans = vbYes Then
Txt_OutlookName.Text = Task1.name
Exit For
End If
End If
Next Task1
However, if there is a different tab open that has the focus, the program errors with "Unable to activate task" at line no nn, or if IE is not even running.
Further investigation reveals that even with IE closed, that task name still exists!
I have investigated and found programs to test if an application is running using "InternetExplore.application", however, that application name always fails , even if IE is running. I have tried IE.application Iexplore.application, and a few others that I dont remember.

So I need to know how to do 3 things:
1. Test to see if IE 10 (10.0.7 currently) is running (on win 7)
2. Test to see if a tab exists that has the name "Outlook Web App" in it
3. Activate that tab.

Thanks much for help