Referring to Command Bars

Because this chapter deals with menus, you're interested in the two CommandBar objects that are built-in menu bars. The Worksheet Menu Bar is the first object in the CommandBars collection, so you can refer to it as one of the following:

CommandBars(l)

CommandBars("Worksheet Menu Bar")

Similarly, you can refer to the Chart Menu Bar object using either one of these:

CommandBars(2)

CommandBars("Chart Menu Bar")

In Chapter 19, I advise against using the index numbers when referring to toolbars, because the toolbar index numbers change from version to version. That warning doesn't apply to the two menu bars. The two menu bars always have index numbers of 1 and 2.

0 0

Post a comment