CommandBarComboBox.AddItem Method
Adds a list item to the specified command bar combo box control . The combo box control must be a custom control and must be a drop-down list box or a combo box.
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
|
|---|
| This method will fail if it's applied to an edit box or a built-in combo box control. |
Syntax
expression.AddItem(Text, Index)
expression A variable that represents a CommandBarComboBox object.
Parameters
| Name | Required/Optional | Data Type | Description |
|---|---|---|---|
| Text | Required | String | The text added to the control. |
| Index | Optional | Variant | The position of the item in the list. If this argument is omitted, the item is added to the end of the list. |
Example
This example adds a combo box control to a command bar. Two items are added to the control, and the number of line items and the width of the combo box are set.
| Visual Basic for Applications |
|---|
|
Note