ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to detect if workbook is running in Internet Explorer (https://www.excelbanter.com/excel-programming/408240-how-detect-if-workbook-running-internet-explorer.html)

Greg Lovern

How to detect if workbook is running in Internet Explorer
 
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

Greg Lovern

How to detect if workbook is running in Internet Explorer
 
If IsRunningInIE Then
MsgBox "Explanatory message, etc."
Exit Sub


Sorry, I meant:


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


Greg

GTVT06

How to detect if workbook is running in Internet Explorer
 
On Mar 24, 2:29*pm, Greg Lovern wrote:
If IsRunningInIE Then
* * MsgBox "Explanatory message, etc."
Exit Sub


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


All times are GMT +1. The time now is 11:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com