Microsoft KB Archive/183540

= XL98: Using the MenuBars Method in Microsoft Excel 98 =

Article ID: 183540

Article Last Modified on 6/17/2005

-

APPLIES TO


 * Microsoft Excel 98 for Macintosh

-



This article was previously published under Q183540





SUMMARY
In Microsoft Excel version 5.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 98 Macintosh Edition, the MenuBars method is replaced by the CommandBars method.

However, to provide backward compatibility, Microsoft Excel 98 supports the MenuBars method. Note that the MenuBars method works differently in Microsoft Excel 98 than it does in earlier versions of Microsoft Excel.

This article contains information about using the MenuBars method in Microsoft Excel 98.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Microsoft Excel 98 Macintosh Edition
In Microsoft Excel 98, menu bars are replaced with command bars. Note that some Microsoft Excel 5.0 menu bars do not have an equivalent command bar. These earlier menu bars have been removed to provide consistency with the other Microsoft Office 98 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 98, you can use the following MenuBars command in a macro MenuBars().Activate where  is a variable.

The following table lists the Microsoft Excel 98 command bar equivalents for the Microsoft Excel version 5.0 menu bars and the corresponding values.   Excel 98                  Value in        Value in   menu bar name             Excel 98        Excel 5.0 --  Worksheet Menu Bar        xlWorksheet     xlWorksheet4 Chart Menu Bar           xlChart         xlChart4 Worksheet Menu Bar       xlWorksheet     xlNoDocuments Worksheet Menu Bar       xlWorksheet     xlInfo Worksheet Menu Bar       xlWorksheet     xlWorksheetShort Chart Menu Bar           xlChart         xlChartShort Worksheet Menu Bar       xlWorksheet     xlWorksheet Chart Menu Bar           xlChart         xlChart Menu in Visual Basic Editor                             xlModule Example:

In Microsoft Excel 98, if you run a macro that contains the following command MenuBars(xlWorksheet4).Activate Microsoft Excel 98 displays the "Worksheet Menu Bar" command bar because the xlWorksheet4 value translates to "Worksheet Menu Bar" in Microsoft Excel 98.

To run the equivalent command in Microsoft Excel 98, use the following command: CommandBars("Worksheet Menu Bar").Visible = True 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 98; there is no equivalent command bar. Instead, you must display the Visual Basic Editor. To do this, use the following command: Application.VBE.MainWindow.Visible = True

Microsoft Excel 5.0
In Microsoft Excel version 5.0, there are nine built-in menu bars that you can display by using the following MenuBars command in a macro MenuBars().Activate where  is a variable.

The following table lists the built-in menu bars and the corresponding values that you use with the MenuBars command.   Menu bar                                   Value ---  Worksheet (Microsoft Excel 4.0)            xlWorksheet4 Chart (Microsoft Excel 4.0)               xlChart4 No Documents Open                         xlNoDocuments Info                                      xlInfo Worksheet (Microsoft Excel 4.0, short)    xlWorksheetShort Chart (Microsoft Excel 4.0, short)        xlChartShort Worksheet                                 xlWorksheet Chart                                     xlChart Visual Basic Module                       xlModule Example:

To display the Microsoft Excel 4.0 Worksheet MenuBar in Microsoft Excel 5.0, use the following command: MenuBars(xlWorksheet4).Activate

Additional query words: XL98

Keywords: kbprb KB183540

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.