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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Is there a "Before" Open event?

try using (untested)
Workbooks.Open(workbookname & ".xls").RunAutoMacros xlAutoOpen
without
RunAutoMacros xlAutoOpen
--
Don Guillett
SalesAid Software

"Michael Purcell" wrote in message
...
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



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
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Excel Discussion (Misc queries) 0 April 23rd 09 08:53 PM
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Setting up and Configuration of Excel 0 April 23rd 09 08:53 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
conditional formula to show "open" or "closed" SBS Excel Worksheet Functions 6 January 28th 06 01:48 AM


All times are GMT +1. The time now is 10:07 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"