Example The Workbooks Open and Before Close Event Handlers

Private Sub Workbook BeforeClose(Cancel As Boolean)

DeleteCustomMenuItem End Sub

Private Sub Workbook Open()

CreateCustomMenuItem End Sub

This event code just calls procedures to create or delete the custom menu. These procedures should be placed in a new code module, so add a module to the SRXUtils project and name it basMenus. Next, place the CreateCustomMenuItem procedure shown in Example 10-2 in basMenus. It is not necessary to completely understand this procedure now, since we will go over the details in Chapter 12. For the moment, note that Example 10-2 creates an ActivateSheet menu item on the Custom menu, and that when we click the item, the routine defined by its OnAction property—in this case, the ActivateSheet subroutine—is run.

0 0

Post a comment