View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Test if spreadsheet id open in IE

A better method is to use the Container property of the workbook. This gives
and Object reference to the containing object IF the book is open as an
embedded object (e.g. in IE). It fails (errors) if Excel is open as a
standalone app, so that needs to be determined with some error handling.

Public Function ExcelOrIE() As String
Dim CName as String

On Error Goto MustBeExcel
CName = ThisWorkbook.Container.Name

If CName = "Microsoft Internet Explorer" Then CName = "IE" Else CName =
"Something Else"

ExcelOrIE = CName
Exit Function

MustBeExcel:
ExcelorIE = "Excel"

End Function

"Jan Kronsell" wrote:

Hi NG!

Is there a way to test if a spreadsheet is opened in native Excel or in
Excel showing in an Internet Explorer window?

Jan