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,