CommandBarComboBox ListHeaderCount 屬性 (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.


[!注意事項] 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.



_運算式_代表**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.