Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Test if spreadsheet id open in IE
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Test if spreadsheet id open in IE
Jan,
I did a bit of puzzling, but following seems to work in most cases. (When explorer is open, or when workbook is open with "open with" Internet Explorer. the structure of the windows, window parents and captions is slightly different. However.. there's the IsInPlace property. You must use the OnTime, as events are run first, before the window is placed in the IEframe... so you have to build a delay.. Once the user has the window visible the delay is not needed. 'Thisworkbook.. Option Explicit Dim bDone As Boolean Private Sub Workbook_Activate() If Not bDone Then bDone = True Call Application.OnTime(Now + TimeSerial(0, 0, 1), _ ThisWorkbook.Name & "!TimedMsg") End If End Sub 'Normal non private module Option Explicit Sub TimedMsg() If ThisWorkbook.IsInPlace Then MsgBox "Yep. I'm loaded in internet Explorer" endif End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Test if spreadsheet id open in IE
If ThisWorkbook.IsInPlace Then
I think this would confirm the file is not opened in Excel but as an object in some other app, that might but not necessarily be IE ? Regards, Peter T "keepITcool" wrote in message .com... Jan, I did a bit of puzzling, but following seems to work in most cases. (When explorer is open, or when workbook is open with "open with" Internet Explorer. the structure of the windows, window parents and captions is slightly different. However.. there's the IsInPlace property. You must use the OnTime, as events are run first, before the window is placed in the IEframe... so you have to build a delay.. Once the user has the window visible the delay is not needed. 'Thisworkbook.. Option Explicit Dim bDone As Boolean Private Sub Workbook_Activate() If Not bDone Then bDone = True Call Application.OnTime(Now + TimeSerial(0, 0, 1), _ ThisWorkbook.Name & "!TimedMsg") End If End Sub 'Normal non private module Option Explicit Sub TimedMsg() If ThisWorkbook.IsInPlace Then MsgBox "Yep. I'm loaded in internet Explorer" endif End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Test if spreadsheet id open in IE
Hi
I give a shot, then get back to you. Jan "keepITcool" wrote in message .com... Jan, I did a bit of puzzling, but following seems to work in most cases. (When explorer is open, or when workbook is open with "open with" Internet Explorer. the structure of the windows, window parents and captions is slightly different. However.. there's the IsInPlace property. You must use the OnTime, as events are run first, before the window is placed in the IEframe... so you have to build a delay.. Once the user has the window visible the delay is not needed. 'Thisworkbook.. Option Explicit Dim bDone As Boolean Private Sub Workbook_Activate() If Not bDone Then bDone = True Call Application.OnTime(Now + TimeSerial(0, 0, 1), _ ThisWorkbook.Name & "!TimedMsg") End If End Sub 'Normal non private module Option Explicit Sub TimedMsg() If ThisWorkbook.IsInPlace Then MsgBox "Yep. I'm loaded in internet Explorer" endif End Sub -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Test if spreadsheet id open in IE
Thnx.
I agree container gives more info then IsInPlace. thnx for the tip. See my original post for delaying any event macro's until loading is complete before calling on the container. -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam K Dales wrote : 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Test to see if a workbook is open | Excel Discussion (Misc queries) | |||
Test for Open File | Excel Programming | |||
Test if a workbook is open already | Excel Programming | |||
Test that a workbook is open | Excel Programming | |||
Test to see if a spreadsheet window is open | Excel Programming |