CommandBarControl Caption 屬性 (Office)CommandBarControl.Caption property (Office)

會取得或設定命令列控制項的標題文字。Gets or sets the caption text for a command bar control. 可讀寫的。Read/write.

注意

[!注意事項] CommandBars 用於部分的 Microsoft Office 應用程式已經由 Microsoft Office Fluent 使用者介面的新功能區元件取代。The use of CommandBars in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface. 如需詳細資訊, 請參閱Office 熟知功能區的總覽For more information, see Overview of the Office Fluent ribbon.

語法Syntax

運算式標題expression.Caption

_運算式_代表**CommandBarControl** 物件的變數。expression A variable that represents a CommandBarControl object.

傳回值Return value

字串String

範例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

注意

控制項的標題也會顯示為其預設的 [工具提示]。A control's caption is also displayed as its default ScreenTip.

另請參閱See also

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.