Tell if workbook is opened in IE

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey Guys,

I was wondering if there is a way I can tell if a workbook that has been
opened is hosted in Interner Explorer.

Ideally what I would like to do is checked if the workbook/ excel
application is hosted in IE on one of the Applciation start up events and
then disable some off my code accordingly.

Thanks for you help.

Regards........Jim
 
I was wondering if there is a way I can tell if a workbook that has
 
In another forum, Jim Rech suggested using ActiveWorkbook.Container.

Ture Magnusson posted this using Jim's suggestion:

Thanks Jim!

Container works perfectly...

Sub CheckIfInInternetExplorer()
'Declare local variable
Dim x As Object

'Try to get container object
On Error Resume Next
Set x = ActiveWorkbook.Container
On Error GoTo 0

'Show result depending on container's typename
Select Case TypeName(x)
Case "Nothing"
MsgBox "The workbook is opened in Excel"
Case "IWebBrowser2"
MsgBox "The workbook is opened in Internet Explorer"
Case Else
MsgBox "The workbook is opened in another application: " & TypeName(x)
End Select

'Clear object variable
Set x = Nothing
End Sub

/Ture
 

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

Back
Top