Microsoft Excel
--
Questions
--
Followers
Top Experts
How can Excel vba tell if it is being executed under Internet Explorer?
I just learned how to count the Excel instances that are open ( http://www-new.experts-exchange.com/questions/22130186/Vba-to-see-if-two-instances-of-excel-are-running.html)
I now need to tell if one of those instances is running under Internet Explorer. Â
Is there any way?
I now need to tell if one of those instances is running under Internet Explorer. Â
Is there any way?
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
ASKER CERTIFIED SOLUTION
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
For this question I only care about the specific instance. In other words, I do not care about any other threads that using Excel.
Ideally my vba functions should not do anything when running under any web browser. But, everyone here uses IE 6 or IE 7, so that might simplify things.
Something like this pseudo code:
if ThisWorkbook is RunningUnderAnyBrowser then exit function.
Ideally my vba functions should not do anything when running under any web browser. But, everyone here uses IE 6 or IE 7, so that might simplify things.
Something like this pseudo code:
if ThisWorkbook is RunningUnderAnyBrowser then exit function.
Check the ThisWorkbook.Container.Nam e - if Excel is running normally, this will cause an error; if under IE, it should return "Microsoft Internet Explorer" (or something similar) ar it will return the name of the container application if the workbook is embedded in say a Word document. I have a recollection that you can't use this directly in the Workbook_Open event - you need to use Application.Ontime with say a 1 second delay.
HTH
Rory
HTH
Rory
That worked great. Â But, FYI, Â I was wrong about using Thisworkbook.
Here is what I had to do instead. Â
  on error resume next
  For Each Workbook In Application.Workbooks
    x = Workbook.Container.Name
    If Not IsEmpty(x) Then GoTo exitsub
  Next Workbook
Thanks a ton
Here is what I had to do instead. Â
  on error resume next
  For Each Workbook In Application.Workbooks
    x = Workbook.Container.Name
    If Not IsEmpty(x) Then GoTo exitsub
  Next Workbook
Thanks a ton






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Glad it worked!
Rory.
Rory.
related questions are Q_22130186 Q_22130644 and  Q_22129061
and, for an even more complete solution, see
https://www.experts-exchange.com/questions/23847763/How-to-tell-if-Excel-is-running-under-ie6-or-ie7.html?anchorAnswerId=22805912#a22805912
https://www.experts-exchange.com/questions/23847763/How-to-tell-if-Excel-is-running-under-ie6-or-ie7.html?anchorAnswerId=22805912#a22805912

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Microsoft Excel
--
Questions
--
Followers
Top Experts
Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.