Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Detecting if workbook running in IE or in Excel

Hi,

Does anyone know if it is possible to detect whether a workbook is
being run under Internet Explorer or within Excel itself. I want to
prevent people running my workbooks/s under IE as it seems to cause too
many problems - as Dave Peterson pointed out. Instead I want to
display a message telling people to follow the instructions in
http://support.microsoft.com/?scid=162059

The only way I can see is to examine registry keys. But would this
cause problems for people without administrative access to their PC?
Is there an easy way to do this?

Any help appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Detecting if workbook running in IE or in Excel

You might see if the Workbook Container or IsInPlace properties are of any
help.

--
Jim
"SkylineGTR" wrote in message
oups.com...
| Hi,
|
| Does anyone know if it is possible to detect whether a workbook is
| being run under Internet Explorer or within Excel itself. I want to
| prevent people running my workbooks/s under IE as it seems to cause too
| many problems - as Dave Peterson pointed out. Instead I want to
| display a message telling people to follow the instructions in
| http://support.microsoft.com/?scid=162059
|
| The only way I can see is to examine registry keys. But would this
| cause problems for people without administrative access to their PC?
| Is there an easy way to do this?
|
| Any help appreciated.
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Detecting if workbook running in IE or in Excel

You are a star Jim!

The Container property was the way to go! Word of caution though, do
not try and get the Container property in Workbook_Open - does not
work. You need to wait until Activate is fired, then you can determine
(it seems) reliably whether you are running in IE or Excel.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Detecting if workbook running in IE or in Excel


I also experienced problems when running in the web.

As a crude workaround I incorporated

If (InStr(1, fname, "//") < 0) Then
msgbox(" This workbook is not configured to run via the web")
exit sub
End If

not exactly robust - but it worked for me

--
jmoffa
-----------------------------------------------------------------------
jmoffat's Profile: http://www.excelforum.com/member.php...nfo&userid=115
View this thread: http://www.excelforum.com/showthread.php?threadid=48093

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Detecting if workbook running in IE or in Excel


I also experienced problems when running in the web.

As a crude workaround I incorporated

If (InStr(1, fname, "//") < 0) Then
msgbox(" This workbook is not configured to run via the web")
exit sub
End If

not exactly robust - but it worked for me

--
jmoffa
-----------------------------------------------------------------------
jmoffat's Profile: http://www.excelforum.com/member.php...nfo&userid=115
View this thread: http://www.excelforum.com/showthread.php?threadid=48093



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Detecting if workbook running in IE or in Excel

Thanks to both Jim and jmoffat,

I realised that I did not share the knowledge I gained - apologies! Do
not know whether this is the best way of doing things, but it works!

1) Create a new module called Module1. Put the following code in:
Public geContainerType As ContainerTypes

Enum ContainerTypes
RunningInExcel
RunningInIE
RunningInUnknownApp
End Enum

Public Sub initiateContainerTest()
Call Application.OnTime(Now + TimeSerial(0, 0, 7),
"CheckContainer")
End Sub


In Activate (*not* workbook_open), called initiateContainerText()

In Module1, add:


Public Sub CheckContainer()
Select Case ExcelOrIE
Case RunningInExcel
MsgBox "Running in Excel"
Case RunningInIE, RunningInUnknownApp
MsgBox "Running in IE"
End Select
End Sub

Public Function ExcelOrIE() As ContainerTypes
Dim lsContainerName As String

On Error GoTo IsExcel
lsContainerName = ThisWorkbook.Container.Name

If lsContainerName = "Microsoft Internet Explorer" Then
geContainerType = RunningInIE
Else
geContainerType = RunningInUnknownApp
End If

ExcelOrIE = geContainerType
Exit Function
IsExcel:
ExcelOrIE = RunningInExcel
End Function

If you do not put the delay in OnTime, then it seems to think it is
running in Excel, when in actual fact it is running in IE - go figure -
any idea. All I know is put the initiateContainerText in
workbook.activate and it works -reliably

Cheers.

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
Not detecting Open Workbook - Why Roger Excel Discussion (Misc queries) 7 January 26th 08 08:16 PM
Not Detecting Open Workbook Status - Odd?? Jenny B. Excel Discussion (Misc queries) 4 January 16th 08 12:47 AM
Detecting if a Window/Workbook is Open Rob Excel Discussion (Misc queries) 5 July 10th 07 10:52 PM
Detecting a another workbook has opended Nigel Excel Programming 1 May 7th 05 08:19 AM
Detecting workbook activation Jack Wolf Excel Programming 0 July 26th 03 01:10 AM


All times are GMT +1. The time now is 06:56 AM.

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

About Us

"It's about Microsoft Excel"