Microsoft Office Tutorials and References
In Depth Information
To create a new Wo rkbook event procedure, follow these steps:
1
Double-click the ThisWorkbook object to activate it.
2
Click the Object drop-down list, and select the Workbook option.
3
Click the Procedure drop-down list, and select the desired event.
In Figure 12-2, the Visual Basic Editor displays the Procedure drop-down list while creating
a new Wo rkbook event procedure.
Figure 12-2. The VB Editor is the best way to create a new event procedure.
After you have created the new event procedure, you’ll notice the Private Sub
Workbook_Event and End Sub lines have been added to the code window. Now that you’ve
created the event procedure’s framework, you can to add the code to be executed when the
event is triggered. Table 12-1 describes the commonly used events that can be attached to the
Workbook object.
Table 12-1. Commonly Used Workbook Events
Workbook Event
Action That Triggers the Event
Open
Monitors the Open event for a workbook. The event is triggered
when the workbook or add-in is opened and executes the
Workbook_Open procedure.
Activate
Monitors the Activate event for a workbook. The event is triggered
whenever the workbook is activated.
Search JabSto ::




Custom Search