CommandBarButton Object

Description

Represents a button control on a command bar.

Using the CommandBarButton Object

Use Controls(index), where index is the index number of the control, to return a CommandBarButton object. (The Type property of the control must be msoControlButton.)

Assuming that the second control on the command bar named "Custom" is a button, the following example changes the style of that button.

Set c = CommandBars("Custom").Controls(2)
With c
If .Type = msoControlButton Then
    If .Style = msoButtonIcon Then
        .Style = msoButtonIconAndCaption
    Else
        .Style = msoButtonIcon
    End If
End If
End With
You can also use the FindControl method to return a CommandBarButton object.

Properties

Application property, BeginGroup property, BuiltIn property, BuiltInFace property, Caption property, Creator property, DescriptionText property, Enabled property, FaceId property, Height property, HelpContextId property, HelpFile property, Id property, Index property, Left property, OLEUsage property, OnAction property, Parameter property, Parent property, Priority property, ShortcutText property, State property, Style property, Tag property, TooltipText property, Top property, Type property, Visible property, Width property.

Methods

Copy method, CopyFace method, Delete method, Execute method (CommandBar controls), Move method, PasteFace method, Reset method, SetFocus method.