Chapter 23. Working with Shortcut Menus

In This Chapter

Although the Ribbon has replaced menus and toolbars, Excel 2007 still offers developers the opportunity to customize the shortcut menus. Typically, right-clicking an item displays a context-sensitive shortcut menu containing relevant commands. In this chapter, I cover the following:

  • How to identify shortcut menus

  • How to customize the shortcut menus

  • How to disable shortcut menus

  • How to use events in conjunction with shortcut menus

  • How to create a completely new shortcut menu

The CommandBar object takes on a much less significant role in Excel 2007. This chapter covers the CommandBar object as it relates to customizing shortcut menus.

CommandBar Overview

A CommandBar object is used for three Excel user interface elements:

  • Custom toolbars

  • Custom menus

  • Customs shortcut (right-click) menus

In Excel 2007, the CommandBar object is in a rather odd position. If you write VBA code to customize a menu or a toolbar, Excel intercepts that code and ignores many of your commands. As I describe in Chapter 22, menu and toolbar customizations performed with the CommandBar object appear in the Add-Ins CommandBar Overview Menu Commands or the Add-Ins CommandBar Overview Custom Toolbars group. So, for all practical purposes, the CommandBar object in Excel 2007 is limited to shortcut menu operations. ...

Get Excel® 2007 Power Programming with VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.