CommandBarButton Object

CommandBarButton
CommandBar

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 | HyperlinkType Property | Id Property | Index Property | IsPriorityDropped Property | Left Property | Mask Property | OLEUsage Property | OnAction Property | Parameter Property | Parent Property | Picture 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 | Move Method | PasteFace Method | Reset Method | SetFocus Method

Events | Click Event

Parent Objects

Child Objects | CommandBar Object