MenuBars Collection Object

Description

A collection of all the MenuBar objects in the Microsoft Excel application. Each MenuBar object represents a built-in or custom menu bar.

Accessors

Use the Add method to add a new menu bar to the application. The following example adds a new menu bar and then activates it.


With MenuBars.Add("Stock Chart")
    With .Menus.Add("File")
        .MenuItems.Add "Update", "UpdateProc"
        .MenuItems.Add "Print", "PrintProc"
    End With
End With
MenuBars("stock chart").Activate

After running the example, you can use MenuBars(xlModule).Activate to restore the Visual Basic Module menu.

Use the MenuBars method with an argument to access a single member of the collection or without an argument to access the entire collection at once.

Properties

Application Property, Count Property, Creator Property, Parent Property.

Methods

Add Method (MenuBars Collection), Item Method.