AddItem Method
This documentation is archived and is not being maintained.

AddItem Method

Adds an item to a list box or a combo box.

expression.AddItem(Text, Index)

expression   Required. An expression that returns a ControlFormat object.

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.


Using this method clears any range specified by the ListFillRange property.


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

With Worksheets(1)
    Set lb = .Shapes.AddFormControl(xlListBox, 100, 10, 100, 100)
    For x = 1 To 10
        lb.ControlFormat.AddItem x
End With
© 2016 Microsoft