CommandBarComboBox 属性 (Office)CommandBarComboBox.ListHeaderCount property (Office)

获取或设置出现在分隔行之上的 CommandBarComboBox 控件中的列表项数目。Gets or sets the number of list items in a CommandBarComboBox control that appears above the separator line. 读/写。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.



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


对于内置的组合框控件,该属性为只读。This property is read-only for built-in combo box controls.

如果ListHeaderCount属性值为-1, 则表示在组合框控件中没有分隔线。A ListHeaderCount property value of - 1 indicates that there's no separator line in the combo box control.


本示例在名为custom的命令栏中添加一个组合框控件, 然后向组合框中添加两个项目。This example adds a combo box control to the command bar named Custom and then adds two items to the combo box. 本示例使用 ListHeaderCount 属性在组合框的第一项和第二项间显示一分隔行。The example uses the ListHeaderCount property to display a separator line between First Item and Second Item in the combo box. 此外,本示例还设置项的行数,组合框的宽度,并将该组合框的默认值设置为空。The example also sets the number of line items, the width of the combo box, and an empty default for the combo box.

Set myBar = CommandBars("Custom") 
Set myControl = myBar.Controls.Add(Type:=msoControlComboBox) 
With myControl 
    .AddItem Text:="First Item", Index:=1 
    .AddItem Text:="Second Item", Index:=2 
    .DropDownLines = 3 
    .DropDownWidth = 75 
    .ListHeaderCount = 1 
End With

另请参阅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.