Activating a Menu Bar

Microsoft Excel automatically displays a built-in menu bar that's appropriate for the active sheet unless you explicitly activate a custom menu bar using a Visual Basic procedure. When you want Microsoft Excel to return to its normal menu bar behavior, you must deactivate the custom menu bar by activating the appropriate built-in menu bar.

Before you can activate a specific menu bar, you must access it using the MenuBars method, with the menu bar caption, index number, or built-in constant as an argument. You can use any of the constants in the following table as an argument to specify a built-in menu bar.

Constant

Associated menu bar

xlWorksheet

The menu bar displayed when a worksheet, macro sheet, or dialog sheet is active

xlChart

The menu bar displayed when a chart is active

xlModule

The menu bar displayed when when a Visual Basic module is active

xlNoDocuments

The menu bar displayed when no documents are open

xlInfo

The menu bar displayed when the Info Window is active

xlWorksheetShort

A short version of the worksheet menu bar (for compatibility with Microsoft Excel version 3.0)

xlChartShort

A short version of the chart menu bar (for compatibility with Microsoft Excel version 3.0)

xlWorksheet4

An old version of the worksheet menu bar (for compatibility with Microsoft Excel version 4.0)

xlChart4

An old version of the chart menu bar (for compatibility with Microsoft Excel version 4.0)


After you've accessed the custom or built-in menu bar you want to activate, use the Activate method to activate it. Microsoft Excel won't allow you to activate a built-in menu bar that isn't appropriate for the active sheet.


MenuBars(xlWorksheet4).Activate