The information in this article applies to:
SUMMARY
In Microsoft Excel versions 5.0 and 7.0, you can use the MenuBars method in
a Visual Basic for Applications macro to display different menu bars in
Microsoft Excel. In Microsoft Excel 97, the MenuBars method is replaced by
the CommandBars method.
MORE INFORMATIONMicrosoft Excel 97In Microsoft Excel 97, menu bars are replaced with command bars. Note that some Microsoft Excel 5.0 and 7.0 menu bars do not have an equivalent command bar. These earlier menu bars have been removed for simplicity and to provide a greater level of consistency with the other Microsoft Office 97 programs. For this reason, if you use the MenuBars method to display a menu bar, a different command bar than the one you specify may appear.To display a command bar in Microsoft Excel 97, you can use the following MenuBars command in a macro:
where <xlConstant> is a variable.
The following table lists the Microsoft Excel 97 command bar equivalents for the Microsoft Excel version 5.0 and 7.0 menu bars, and the corresponding values.
Example:
In Microsoft Excel 97, if you run a macro that contains the following command:
Microsoft Excel 97 displays the "Worksheet Menu Bar" command bar, because
the xlWorksheet4 value translates to "Worksheet Menu Bar" in Microsoft
Excel 97.
To run the equivalent command in Microsoft Excel 97, use the following command:
NOTE: The CommandBars command does not use the value listed in the table.
Instead, the command uses the name of the command bar that you want to
display.
The Visual Basic Module Menu Bar: The "Visual Basic Module" (xlModule) menu bar is not available in Microsoft Excel 97; there is no equivalent command bar. Instead, you must display the Visual Basic Editor. To do this, use the following command:
Microsoft Excel 5.0 and 7.0In Microsoft Excel versions 5.0 and 7.0, there are nine built-in menu bars that you can display by using the following MenuBars command in a macro:
where <xlConstant> is a variable.
The following table lists the built-in menu bars and the corresponding values that you use with the MenuBars command.
Example:
To display the Microsoft Excel 4.0 Worksheet MenuBar in Microsoft Excel 5.0 or 7.0, use the following command:
REFERENCESFor more information about using the MenuBars method in Microsoft Excel 97, activate a Visual Basic module, type the following text menubarsselect the word, and press F1 to display the "Hidden Properties and Methods" help topic. Additional query words: XL97 8.0
Keywords : kbinterop kbdta KbVBA xlvbmigrate |
Last Reviewed: July 2, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |