ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook container - can't get it to work (https://www.excelbanter.com/excel-programming/325354-workbook-container-cant-get-work.html)

Ken Valenti

Workbook container - can't get it to work
 
I cannot get this to work - is there a reference I am missing or ???

Sub TestContainer()
msgbox thisworkbook.container
end sub

I've gleened this from

Sub CheckIfInInternetExplorer()
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
End Sub


which I can't get to work either. It compiles, but activeworkbook.container
yields an error.

Ive tried three different machines, and have tried Excel 97, 2000 & 2003.

I am trying to determine if the excel workbook has been opened in a browser,
or the excel application.

Thanks in advance,



All times are GMT +1. The time now is 02:39 AM.

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