Add Method (MenuBars Collection)

Applies To

MenuBars Collection.

Description

Creates a new menu bar. Returns a MenuBar object.

Syntax

object.Add(name)

object

Required. The MenuBars object.

name

Optional. The name for the new menu bar.

Remarks

The name of the menu bar is the same as its caption.

Example

The following example adds a new menu bar and then activates it. After running the example, you can use MenuBars(xlModule).Activate to restore the Visual Basic Module menu.


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