Excel also allows us to assign macros to existing menus and toolbars, which is also done from the Commands tab of the Customize dialog shown in Figure 10-3.
Although many users find the Commands tab, and the menu and toolbar customization features in Office, to be confusing and intimidating, they are actually quite simple if we keep the following in mind: ordinarily, menus and toolbars are in run mode. In this mode, selecting a menu item or a toolbar button causes the corresponding action to be performed. On the other hand, whenever the Customize dialog is visible, menus and toolbars are in edit mode. While in edit mode, clicking on a menu item or button has an entirely different effect. In particular, right-clicking on a menu item displays a menu with the item's properties. Also, we can move, delete, or add items to a menu simply by dragging and dropping these items!
Since edit mode is active whenever the Customize dialog is visible, you should be very careful not to inadvertently drag a menu item (or toolbar button) off of a menu (or toolbar), because this will delete that item from the menu (or toolbar).
So, to assign a macro to a toolbar or menu item, make sure the Customize dialog is visible, select Macros in the Categories list (see Figure 10-3), and drag the macro from the Commands list to the appropriate location on the menu or toolbar. That's it.
It is worth pointing out that customizing menus and toolbars through the Customize dialog, as we have just described, may be the right way to proceed for developers, but it also may be too much to ask a client to perform this customization himself. The alternative is to create the custom object programmatically, as discussed in Chapter 12. This is something you will need to judge for yourself.
Was this article helpful?