Workbook events are triggered when certain actions are performed on a workbook, such as opening or closing it, saving it, or changing worksheets. These events can be used to run macros or custom functions whenever a workbook is opened, closed, saved, or changed. For example, you could use a workbook event to automatically save a backup copy of a workbook every time it is saved.
There are two types of workbook events: those that are triggered by an action taken by the user (such as opening or closing the workbook), and those that are triggered by an action taken by Excel (such as calculating a formula). User-initiated events can be handled by using macros or custom functions, while Excel-initiated events can be handled by using Visual Basic for Applications (VBA) code.
The following table lists the user-initiated workbook events:
|Triggered when the workbook is opened|
|Triggered when the workbook becomes the active workbook|
|Triggered when the workbook is no longer the active workbook|
|Triggered when the workbook is about to be closed|
|Triggered after the workbook is saved|