ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Invoke exclusive excel process on opening this file (https://www.excelbanter.com/excel-programming/336543-invoke-exclusive-excel-process-opening-file.html)

JB2005

Invoke exclusive excel process on opening this file
 
An excel workbook is required to start/use an exclusive Excel.exe process
whenever it is opened.

This is to enable it to use specific tools/options settings which may
conflict with those already in use by other open files that may share an
existing process.

eg. some workbooks will use "Auto calc.", others "Manual calc." options

Any ideas?

Norman Jones

Invoke exclusive excel process on opening this file
 
Hi JB,

Rather than seeking to use a separate instance of Excel, perhaps you could
use the Workbook's Activate and Deactivate events.

In the activate event, read and store the current values of any relevant
Excel level settings and then change these to values appropriate to the
workbook.

In the Workbook's deactivate event, restore the relevant settings to the
stored values.

As a simple example, in the workbook's ThisWorbook module:

Option Explicit
Public CalcMode As Long

'=======================
Private Sub Workbook_Activate()

CalcMode = Application.Calculation

Application.Calculation = xlCalculationManual

End Sub
'<<=======================

'=======================
Private Sub Workbook_Deactivate()

Application.Calculation = CalcMode

End Sub
'<<=======================


---
Regards,
Norman



"JB2005" wrote in message
...
An excel workbook is required to start/use an exclusive Excel.exe process
whenever it is opened.

This is to enable it to use specific tools/options settings which may
conflict with those already in use by other open files that may share an
existing process.

eg. some workbooks will use "Auto calc.", others "Manual calc." options

Any ideas?





All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com