The following event handlers are included in the project template code files. For more information, see Visual Studio Tools for Office Project Events.
Startup Event Handlers
These event handlers handle the Workbook..::.Startup and Worksheet..::.Startup events. These events are raised for each of the worksheets and the workbook after the solution is running and all the initialization code in the assembly has run. Use these event handlers to run code that initializes your solution.
The Startup event handlers in a template solution are called in this order:
ThisWorkbook_Startup.
Sheet1_Startup.
Sheet2_Startup.
Sheet3_Startup.
Other sheets in order.
The order is determined when the project is compiled. If the user rearranges the sheets at run time, it does not change the order that the events are raised the next time the workbook is opened.
Shutdown Event Handlers
These event handlers handle the Workbook..::.Shutdown and Worksheet..::.Shutdown events. These events are raised for each of the worksheets and the workbook when the application domain that your code is loaded in is about to unload.
The Shutdown event handlers in a template solution are called in this order:
ThisWorkbook_Shutdown.
Sheet1_Shutdown.
Sheet2_Shutdown.
Sheet3_Shutdown.
Other sheets in order.