How to detect if workbook is running in Internet Explorer

G

Greg Lovern

Apparently some of our users are trying to run our workbook in
Internet Explorer instead of in Excel. Works fine with some other
workbooks but not with the code in our workbook.

We don't have the time to try to get it to work in Internet Explorer
right now. Instead, we'd like to detect whether the workbook is
running in IE, and exit, after maybe a brief message to the user. For
example:

If IsRunningInIE Then Exit Sub

Or, in the Workbook Open Event:

If IsRunningInIE Then
MsgBox "Explanatory message, etc."
Exit Sub


Any suggestions?


Thanks,

Greg
 
G

Greg Lovern

If IsRunningInIE Then
MsgBox "Explanatory message, etc."
Exit Sub

Sorry, I meant:


If IsRunningInIE Then
MsgBox "Explanatory message, etc."
Exit Sub
End If


Greg
 
G

GTVT06

Sorry, I meant:

If IsRunningInIE Then
    MsgBox "Explanatory message, etc."
    Exit Sub
End If

Greg

you can close it by looping thru open windows and closing down the
window if the URL = whatever shows up in the internet explorer URL
address bar whenever they open it in IE

Dim objShell, ObjShellWindows, objW
Set objShell = CreateObject("Shell.Application")
Set ObjShellWindows = objShell.Windows
For Each objW In ObjShellWindows
If objW.LocationURL Like "whatever shows up" Then
objW.Quit
End If
Next
Exit Sub
 

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