Table of contents
TOC
折叠目录
展开目录

CommandBarComboBox.List 属性 (办公室)CommandBarComboBox.List Property (Office)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

获取或设置CommandBarComboBox控件中的项。读/写。Gets or sets an item in the CommandBarComboBox control. Read/write.

请注意 已通过 Microsoft Office 流畅的用户界面的新功能区组件取代某些 Microsoft Office 应用程序中的命令栏使用。有关更多信息,请搜索帮助关键字"功能区"。Note The use of CommandBars in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface. For more information, search Help for the keyword "ribbon."

语法Syntax

表达式列表索引expression. List( Index )

表达式_一个表示CommandBarComboBox对象的变量。_expression A variable that represents a CommandBarComboBox object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
IndexIndex必需RequiredIntegerInteger要设置的列表项。The list item to be set.

注解Remarks

请注意 此属性是只读的内置的组合框控件。Note This property is read-only for built-in combo box controls.

示例Example

本示例检查在其标题为"存货数据"命令栏"custom。"的组合框控件中的第四个列表项如果该项目不是"View News",该示例将显示一条消息提示用户组合框可能已损坏并要求重新安装应用程序。This example checks the fourth list item in the combo box control whose caption is "Stock Data" on the command bar named "Custom." If the item isn't "View News," the example displays a message advising the user that the combo box may be damaged and asks the user to reinstall the application.

Set myBar = CommandBars _ 
    .Add(Name:="Custom", Position:=msoBarTop, _ 
    Temporary:=True) 
With myBar 
    .Controls.Add Type:=msoControlComboBox, ID:=1 
    .Visible = True  
End With 
With CommandBars("Custom").Controls(1) 
    .AddItem "Get Stock Quote", 1 
    .AddItem "View Chart", 2 
    .AddItem "View Fundamentals", 3 
    .AddItem "View News", 4 
    .Caption = "Stock Data" 
    .DescriptionText = "View Data For Stock" 
End With 
If CommandBars("Custom").Controls(1).List(4) _ 
     > "View News" Then 
MsgBox ("Stock Data appears to be damaged." & _ 
     " Please reinstall application.") 
End If

另请参阅See also

概念Concepts

CommandBarComboBox 对象CommandBarComboBox Object

其他资源Other resources

CommandBarComboBox 对象成员CommandBarComboBox Object Members

© 2018 Microsoft