Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Locking(?) an excel session

While a long macro is running in Excel 2002 VBA, and a user opens another
Excel document on the PC, or opens an excel attachment in an email, I would
like to prevent these Excel documents opening in the same session/instance
as the one in which the macro is running, and start a new instance of Excel
if necessary.

Is there any way in VBA to control this?

--Kiloran


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Locking(?) an excel session


Just an idea.. but it seems to work :)

code must run in a class module..(which could be Thisworkbook
if the xlApp is instantiated then the event handler will create
a new instance.

Option Explicit

Dim WithEvents xlApp As Application

Sub LockAPP()
Set xlApp = New Application
End Sub


Private Sub xlApp_WorkbookOpen(ByVal Wb As Workbook)
Dim newApp As Object
Set newApp = CreateObject("Excel.Application")
newApp.Workbooks.Open Wb.FullName
End Sub




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Kiloran wrote :

While a long macro is running in Excel 2002 VBA, and a user opens
another Excel document on the PC, or opens an excel attachment in an
email, I would like to prevent these Excel documents opening in the
same session/instance as the one in which the macro is running, and
start a new instance of Excel if necessary.

Is there any way in VBA to control this?

--Kiloran


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Locking(?) an excel session

In tools=Options in the general tab, select Ignore Other applications.

Application.IgnoreRemoteRequests = True

in VBA

--
Regards,
Tom Ogilvy

"Kiloran" wrote in message
...
While a long macro is running in Excel 2002 VBA, and a user opens another
Excel document on the PC, or opens an excel attachment in an email, I

would
like to prevent these Excel documents opening in the same session/instance
as the one in which the macro is running, and start a new instance of

Excel
if necessary.

Is there any way in VBA to control this?

--Kiloran




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Locking(?) an excel session

Brilliant! Just what I needed.

Many thanks Tom, you have an enviable knowledge of VBA

--Kiloran

"Tom Ogilvy" wrote in message
...
In tools=Options in the general tab, select Ignore Other applications.

Application.IgnoreRemoteRequests = True

in VBA

--
Regards,
Tom Ogilvy

"Kiloran" wrote in message
...
While a long macro is running in Excel 2002 VBA, and a user opens

another
Excel document on the PC, or opens an excel attachment in an email, I

would
like to prevent these Excel documents opening in the same

session/instance
as the one in which the macro is running, and start a new instance of

Excel
if necessary.

Is there any way in VBA to control this?

--Kiloran






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
Excel (Session) Hijacking problem Bob[_4_] Excel Discussion (Misc queries) 0 April 12th 07 04:46 PM
Startup and template locations in Citrix TS session and local session John Nurick Setting up and Configuration of Excel 2 September 21st 06 10:42 PM
Using alt-tab to switch between Excel workbooks under the same session Kjetil Excel Discussion (Misc queries) 0 June 22nd 06 03:39 PM
Each New Excel to open in another session tinwasp Excel Worksheet Functions 1 December 8th 05 05:44 PM
Can't alt-tab between Excel workbooks in one session. Help! LW Excel Discussion (Misc queries) 2 April 6th 05 12:42 PM


All times are GMT +1. The time now is 12:57 PM.

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"