Edit

Share via


CommandBarControls.Add(Object, Object, Object, Object, Object) Method

Definition

Creates a new CommandBarControl object and adds it to the collection of controls on the specified command bar.

public Microsoft.Office.Core.CommandBarControl Add (object Type, object Id, object Parameter, object Before, object Temporary);
abstract member Add : obj * obj * obj * obj * obj -> Microsoft.Office.Core.CommandBarControl
Public Function Add (Optional Type As Object, Optional Id As Object, Optional Parameter As Object, Optional Before As Object, Optional Temporary As Object) As CommandBarControl

Parameters

Type
Object

Optional Object. The type of control to be added to the specified command bar. Can be one of the following MsoControlType constants: msoControlButton, msoControlEdit, msoControlDropdown, msoControlComboBox, or msoControlPopup.

Id
Object

Optional Object. An integer that specifies a built-in control. If the value of this argument is 1, or if this argument is omitted, a blank custom control of the specified type will be added to the command bar.

Parameter
Object

Optional Object. For built-in controls, this argument is used by the container application to run the command. For custom controls, you can use this argument to send information to procedures, or you can use it to store information about the control (similar to a second Tag property value).

Before
Object

Optional Object. A number that indicates the position of the new control on the command bar. The new control will be inserted before the control at this position. If this argument is omitted, the control is added at the end of the specified command bar.

Temporary
Object

Optional Object. True to make the new control temporary. Temporary controls are automatically deleted when the container application is closed. The default value is False.

Returns

Applies to