Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying text from a Browser window into Excel Don[_2_] New Users to Excel 1 March 20th 07 05:23 PM
Launch new browser window from an excel web page Hal Anderson Excel Discussion (Misc queries) 2 January 20th 06 02:10 AM
Launch new browser window from hyperlink within Excel Hal Anderson Excel Worksheet Functions 0 December 1st 05 11:17 PM
Want Excel Hyperlinks to reuse browser window David Samson Excel Programming 1 December 9th 04 06:44 AM
Running macro in a browser window Ted Theodoropoulos Excel Programming 1 August 4th 03 08:24 PM


All times are GMT +1. The time now is 03:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"