Removes an item from a CommandBarComboBox control.

Note
The use of CommandBars in some Microsoft Office applications has been superseded by the new Ribbon user interface. For more information, search help for the keyword "Ribbon."
Note
The property fails when applied to controls other than list controls.

Syntax

expression.RemoveItem(Index)

expression A variable that represents a CommandBarComboBox object.

Parameters

Name Required/Optional Data Type Description
Index Required Integer The item to be removed from the list.

Example

This example determines whether there are more than three items in the specified combo box. If there are more than three items, the example removes the second item, alters the style, and sets a new value. It also sets the Tag property of the parent object (the CommandBarControl object) to show that the list has changed.

Visual Basic for Applications
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 Set myControl = myBar.Controls(1) With myControl If .ListCount > 3 Then .RemoveItem 2 .Style = msoComboNormal .Text = "New Default" Set ctrl = .Parent End If End With
cut from the command bar combo box control a specific item listed delete an item from the list shown on a command bar combo box control ofv remove remove an item from a specific command bar combo box control remove item Remove Item Method removeitem RemoveItem Method

See also: