Example The Revised Versions of This Workbooks Open and Close Events

Private Sub Workbook Open()

CreateCustomMenus End Sub

The code for creating the custom menu is more complicated than the one from Chapter 10 because we must now extract the necessary information from the DataSheet worksheet. There are many ways to do this, but we have elected to split the process into two procedures. The first procedure, CreateCustomMenus, checks for the existence of the custom menus using the Tag property. If the menu exists, it is deleted. Then the procedure calls the second procedure, CreateCustomMenu, which actually does the menu creation. This is done once for the worksheet menu bar and once for the chart menu bar. The first procedure is shown in Example 1211.

0 0

Post a comment