In previous versions of Excel, programmers created custom menus and toolbars by using the CommandBar object. In Excel 2007, the CommandBar object is still available, but it doesn't work like it has in the past.
CROSS- Refer to Chapter 22 for more information about the CommandBar object.
The CommandBar object has also been enhanced in Excel 2007. You can use the CommandBar object to execute Ribbon commands using VBA. Many of the Ribbon commands display a dialog box. For example, the statement below displays the Go To dialog box:
The ExecuteMso method accepts one argument, an idMso parameter that represents a Ribbon control. Unfortunately, these parameters are not listed in the Help system.
CD- The companion CD-ROM contains a file, ® ribbon control names. xlsx, that lists ROM all of the Excel Ribbon command parameter names.
Following is another example. This statement, when executed, displays the Font tab of the Format Cells dialog box (see Figure 12-12):
Was this article helpful?