_CommandBars.Add Method

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

Namespace:  Microsoft.Office.Core
Assembly:  office (in office.dll)

Syntax

'Declaration
Function Add ( _
    Name As Object, _
    Position As Object, _
    MenuBar As Object, _
    Temporary As Object _
) As CommandBar
'Usage
Dim instance As _CommandBars
Dim Name As Object
Dim Position As Object
Dim MenuBar As Object
Dim Temporary As Object
Dim returnValue As CommandBar

returnValue = instance.Add(Name, Position, _
    MenuBar, Temporary)
CommandBar Add(
    Object Name,
    Object Position,
    Object MenuBar,
    Object Temporary
)

Parameters

  • Name
    Type: System.Object

    Optional Object. 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
    Type: System.Object

    Optional Object. 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
    Type: System.Object

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

  • Temporary
    Type: System.Object

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

Return Value

Type: Microsoft.Office.Core.CommandBar

See Also

Reference

_CommandBars Interface

_CommandBars Members

Microsoft.Office.Core Namespace