Share via


Caption Property

Returns or sets the caption text for a command bar control. Read/write String.

Note  A control's caption is also displayed as its default ScreenTip.

Example

This example adds a command bar control with a spelling checker button face to a custom command bar, and then it sets the caption to "Spelling checker."

Set myBar = CommandBars.Add(Name:="Custom", _
Position:=msoBarTop, Temporary:=True)
myBar.Visible = True
Set myControl = myBar.Controls _
.Add(Type:=msoControlButton, Id:=2)
With myControl
    .DescriptionText = "Starts the spelling checker"
    .Caption = "Spelling checker"
End With

Applies to | CommandBarButton Object | CommandBarComboBox Object | CommandBarControl Object | CommandBarPopup Object

See Also | CommandBarControl Object | DescriptionText Property | Enabled Property | TooltipText Property