![]() |
Is there a "Before" Open event?
When the Excel application is open with at least one workbook open
(Book1) and another existing Workbook (Book 2) is then opened (it doesn't matter which one), some volatile code in the first workbook will run before any events occur. I assume this means that the sheet recalculates and runs any volatile functions before any events occur. I would like to run some code before any existing code in the first workbook is executed, so that I can record the saved state of the workbook. According to my testing, based on Message Boxes in the various event proceedures, the first event that occurs is the Workbook_open event of the second workbook. All of the applicable Workbook and Application events occur after that, with the SheetCalculate events occuring last (and twice). According to my testing, the sequence of events that occur when the second workbook opens are as follows: Book 1: Volatile code executes (twice for each function call) Book 2: Workbook_Open Application: App_WorkbookOpen Book 1: Workbook_WindowDeactivate Application: App_WindowDeactivate Book 1: Workbook_Deactivate Application: App_WorkbookDeactivate Book 2: Workbook_Activate Application App_WorkbookActivate Book 2: Workbook_WindowActivate Application App_WindowActivate Book 1: Workbook_SheetCalculate Application: App_SheetCalculate Book 1: Workbook_SheetCalculate Application: App_SheetCalculate I am beginning to suspect that there is no event available to do what I want, but I'm hoping I'm wrong, and someone more familiar with the Excel architecture can tell me where to put my code. Michael Purcell |
Is there a "Before" Open event?
|
All times are GMT +1. The time now is 10:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com