PC Review


Reply
Thread Tools Rate Thread

Determine if Excel is running in a browser window

 
 
John Michl
Guest
Posts: n/a
 
      27th Oct 2006
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      27th Oct 2006
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" <xrrcvgp...@puryyb.ay>
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" <xrrcvgp...@puryyb.ay>
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
>
>

 
Reply With Quote
 
John Michl
Guest
Posts: n/a
 
      27th Oct 2006
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" <xrrcvgp...@puryyb.ay>
> 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" <xrrcvgp...@puryyb.ay>
> 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
> >
> >


 
Reply With Quote
 
John Michl
Guest
Posts: n/a
 
      28th Oct 2006
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" <waxwi...@gmail.com> 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" <xrrcvgp...@puryyb.ay>
> > 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" <xrrcvgp...@puryyb.ay>
> > 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


 
Reply With Quote
 
=?Utf-8?B?R2FyeSBCcm93bg==?=
Guest
Posts: n/a
 
      30th Oct 2006
John,
Thank you for posting your solution. While I don't have a current need
for it, it is DEFINITELY going into my library for future use.!!!
Sincerely,
Gary Brown
(E-Mail Removed)



"John Michl" wrote:

> 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" <waxwi...@gmail.com> 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" <xrrcvgp...@puryyb.ay>
> > > 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" <xrrcvgp...@puryyb.ay>
> > > 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

>
>

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      30th Oct 2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <waxwi...@gmail.com> 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" <xrrcvgp...@puryyb.ay>
> > > 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" <xrrcvgp...@puryyb.ay>
> > > 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

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine if browser window already open MikeTI Microsoft ADO .NET 1 5th Sep 2009 01:14 PM
Determine Client Browser Window Size =?Utf-8?B?Q2hyaXM=?= Microsoft ASP .NET 1 15th Jul 2006 05:14 AM
How do I get an IE browser window to display when running instead of in the VS IDE? acool Microsoft ASP .NET 1 28th Jun 2004 06:54 PM
Running Applications in Browser Window Craig Windows XP Internet Explorer 2 21st May 2004 02:41 PM
Running Powerpoint in a browser window Rob Hancock Microsoft Powerpoint 1 23rd Jan 2004 03:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:49 PM.