![]() |
Determine if Excel is running in a browser window
Thanks, Tom. I didn't quite understand the response from keepITcoll
but the clue about the container property lead me to another post by keepITcool which contained enough code for me to test and confirm the process. Here's a link. http://groups-beta.google.com/group/...ae1958a648bd13 - John Tom Ogilvy wrote: I don't have any experience with it, but to a similar question, KeepItCool replied: 1 From: keepITcool - view profile Date: Mon, Jun 13 2005 10:37 am Email: "keepITcool" Groups: microsoft.public.excel.programming Not yet ratedRating: show options Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse | Find messages by this author look at the workbooks' container property but be carefull you cannot do it in any open event as the container is only available when the book is fully loaded. -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam stockbuildingsupply wrote : - Hide quoted text - - Show quoted text - i have a web application that streams an excel workbook to the client. i want to prevent the user from saving the workbook locally. the user should only be able to work with the workbook through the web browser. is there a way to tell if excel is being run in a web browser? Reply 2 From: keepITcool - view profile Date: Mon, Jun 13 2005 7:46 pm Email: "keepITcool" Groups: microsoft.public.excel.programming Not yet ratedRating: show options Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse | Find messages by this author it cannot be placed in the activation event directly. you'll need to delay it until activation has completed. In the workbook_activate event include an application.ontime to call the "containertest" with a 1 second delay. -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam --------------------------------- If you need help on using Application.Ontime, look at http://www.cpearson.com/excel/ontime.htm -- Regards, Tom Ogilvy "John Michl" wrote: Is there a way to determine if the user is running Excel in a browser window or in an instance of Excel? I have a calculator model that is posted on our intranet. The instructions indicate that people are supposed right-click on the link and save it to their computer then open it in Excel. Inevitable, people double-click then start using the tool in a browser window instead. Much of the VBA code doesn't work properly. I'll like to change the workbook_open code to 1) Determine if in browser mode and if so, then 2) Issue a warning. Thanks. - John |
Determine if Excel is running in a browser window
Here's my solution.
In ThisWorkbook: Dim bDone As Boolean Private Sub Workbook_Activate() If Not bDone Then bDone = True Call Application.OnTime(Now + TimeSerial(0, 0, 1), "TimedMsg") End If End Sub In Module1: Sub TimedMsg() On Error GoTo NativeExcel CName = ThisWorkbook.Container.Name ' will error if no container (Native Excel = no container) MsgBox "Warning! You are running in a browser window." Exit Sub NativeExcel: MsgBox "You're in Excel." End Sub On Oct 27, 4:10 pm, "John Michl" wrote: Thanks, Tom. I didn't quite understand the response from keepITcoll but the clue about the container property lead me to another post by keepITcool which contained enough code for me to test and confirm the process. Here's a link.http://groups-beta.google.com/group/...cel.programmin... - John Tom Ogilvy wrote: I don't have any experience with it, but to a similar question, KeepItCool replied: 1 From: keepITcool - view profile Date: Mon, Jun 13 2005 10:37 am Email: "keepITcool" Groups: microsoft.public.excel.programming Not yet ratedRating: show options Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse | Find messages by this author look at the workbooks' container property but be carefull you cannot do it in any open event as the container is only available when the book is fully loaded. -- keepITcool |www.XLsupport.com| keepITcool chello nl | amsterdam stockbuildingsupply wrote : - Hide quoted text - - Show quoted text - i have a web application that streams an excel workbook to the client. i want to prevent the user from saving the workbook locally. the user should only be able to work with the workbook through the web browser. is there a way to tell if excel is being run in a web browser? Reply 2 From: keepITcool - view profile Date: Mon, Jun 13 2005 7:46 pm Email: "keepITcool" Groups: microsoft.public.excel.programming Not yet ratedRating: show options Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse | Find messages by this author it cannot be placed in the activation event directly. you'll need to delay it until activation has completed. In the workbook_activate event include an application.ontime to call the "containertest" with a 1 second delay. -- keepITcool |www.XLsupport.com| keepITcool chello nl | amsterdam --------------------------------- If you need help on using Application.Ontime, look at http://www.cpearson.com/excel/ontime.htm -- Regards, Tom Ogilvy "John Michl" wrote: Is there a way to determine if the user is running Excel in a browser window or in an instance of Excel? I have a calculator model that is posted on our intranet. The instructions indicate that people are supposed right-click on the link and save it to their computer then open it in Excel. Inevitable, people double-click then start using the tool in a browser window instead. Much of the VBA code doesn't work properly. I'll like to change the workbook_open code to 1) Determine if in browser mode and if so, then 2) Issue a warning. Thanks. - John |
Determine if Excel is running in a browser window
That confirms if the workbook is 'contained' in what may or may not be a
browser. If that's all you need could return IsInPlace without need to handle the possible error. Though would still need to wait until fully loaded. If necessary adapt along the lines of K-Dales example - http://tinyurl.com/yhbg4v Regards, Peter T "John Michl" wrote in message oups.com... Here's my solution. In ThisWorkbook: Dim bDone As Boolean Private Sub Workbook_Activate() If Not bDone Then bDone = True Call Application.OnTime(Now + TimeSerial(0, 0, 1), "TimedMsg") End If End Sub In Module1: Sub TimedMsg() On Error GoTo NativeExcel CName = ThisWorkbook.Container.Name ' will error if no container (Native Excel = no container) MsgBox "Warning! You are running in a browser window." Exit Sub NativeExcel: MsgBox "You're in Excel." End Sub On Oct 27, 4:10 pm, "John Michl" wrote: Thanks, Tom. I didn't quite understand the response from keepITcoll but the clue about the container property lead me to another post by keepITcool which contained enough code for me to test and confirm the process. Here's a link.http://groups-beta.google.com/group/...cel.programmin.. .. - John Tom Ogilvy wrote: I don't have any experience with it, but to a similar question, KeepItCool replied: 1 From: keepITcool - view profile Date: Mon, Jun 13 2005 10:37 am Email: "keepITcool" Groups: microsoft.public.excel.programming Not yet ratedRating: show options Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse | Find messages by this author look at the workbooks' container property but be carefull you cannot do it in any open event as the container is only available when the book is fully loaded. -- keepITcool |www.XLsupport.com| keepITcool chello nl | amsterdam stockbuildingsupply wrote : - Hide quoted text - - Show quoted text - i have a web application that streams an excel workbook to the client. i want to prevent the user from saving the workbook locally. the user should only be able to work with the workbook through the web browser. is there a way to tell if excel is being run in a web browser? Reply 2 From: keepITcool - view profile Date: Mon, Jun 13 2005 7:46 pm Email: "keepITcool" Groups: microsoft.public.excel.programming Not yet ratedRating: show options Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse | Find messages by this author it cannot be placed in the activation event directly. you'll need to delay it until activation has completed. In the workbook_activate event include an application.ontime to call the "containertest" with a 1 second delay. -- keepITcool |www.XLsupport.com| keepITcool chello nl | amsterdam --------------------------------- If you need help on using Application.Ontime, look at http://www.cpearson.com/excel/ontime.htm -- Regards, Tom Ogilvy "John Michl" wrote: Is there a way to determine if the user is running Excel in a browser window or in an instance of Excel? I have a calculator model that is posted on our intranet. The instructions indicate that people are supposed right-click on the link and save it to their computer then open it in Excel. Inevitable, people double-click then start using the tool in a browser window instead. Much of the VBA code doesn't work properly. I'll like to change the workbook_open code to 1) Determine if in browser mode and if so, then 2) Issue a warning. Thanks. - John |
All times are GMT +1. The time now is 08:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com