Syntax

expression.AddItem(Text, Index)

expression A variable that represents a ControlFormat object.

Parameters

Name Required/Optional Data Type Description
Text Required String The text to be added.
Index Optional Variant The position of the new entry. If the list has fewer entries than the specified index, blank items from the end of the list are added to the specified position. If this argument is omitted, the item is appended to the existing list.

Remarks

Using this method clears any range specified by the property.

Example

This example creates a list box and fills it with integers from 1 to 10.

Visual Basic for Applications
With Worksheets(1) Set lb = .Shapes.AddFormControl(xlListBox, 100, 10, 100, 100) For x = 1 To 10 lb.ControlFormat.AddItem x Next End With
Add a line item to drop down list box? add item add item method additem AddItem Method Fill listbox? Insert another item into a listbox?

See also: