Add Method (CommandBars Collection)

Add Method (CommandBars Collection)

See Also         Example         Applies To         Specifics

Creates a new command bar and adds it to the collection of command bars. Returns a CommandBar object.

Syntax

expression.Add(Name, Position, MenuBar, Temporary)

expression   Required. An expression that returns a CommandBars object.

Name   Optional Variant. The name of the new command bar. If this argument is omitted, a default name is assigned to the command bar (such as "Custom 1").

Position   Optional Variant. The position or type of the new command bar. Can be one of the MsoBarPosition constants listed in the following table.

Constant Description
msoBarLeft, msoBarTop, msoBarRight, msoBarBottom Indicates the left, top, right, and bottom coordinates of the new command bar
msoBarFloating Indicates that the new command bar won't be docked
msoBarPopup Indicates that the new command bar will be a shortcut menu
msoBarMenuBar Macintosh only

MenuBar   Optional Variant. True to replace the active menu bar with the new command bar. The default value is False.

Temporary   Optional Variant. True to make the new command bar temporary. Temporary command bars are deleted when the container application is closed. The default value is False.