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

获取或设置命令栏控件的标题文字。Gets or sets the caption text for a command bar control. 读/写。Read/write.


某些 Microsoft Office 应用程序中对 CommandBars 的使用已由 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.



_表达式_一个代表**CommandBarControl** 对象的变量。expression A variable that represents a CommandBarControl object.

返回值Return value



本示例在自定义命令栏中添加一个带有拼写检查按钮图标的命令栏控件, 然后将标题设置为拼写检查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.