O'Reilly logo

Excel® 2007 Power Programming with VBA by John Walkenbach

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required