ListEntries Collection Object

Description

A collection of ListEntry objects that represent all the items in a drop-down form field.

Using the ListEntries collection

Use the ListEntries property to return the ListEntries collection. The following example displays the items that appear in the form field named "Drop1."

For Each le In ActiveDocument.FormFields("Drop1").DropDown.ListEntries
    MsgBox le.Name
Next le
Use the Add method to add an item to a drop-down form field. The following example inserts a drop-down form field and then adds "red," "blue," and "green" to the form field.

Set myField = ActiveDocument.FormFields.Add(Range:=Selection.Range, _
    Type:=wdFieldFormDropDown)
With myField.DropDown.ListEntries
    .Add Name:="Red"
    .Add Name:="Blue"
    .Add Name:="Green"
End With
Use ListEntries(index), where index is the list entry name or the index number, to return a single ListEntry object. The index number represents the position of the entry in the drop-down form field (the first item is index number 1). The following example deletes the "Blue" entry from the drop-down form field named "Color."

ActiveDocument.FormFields("Color").DropDown.ListEntries("Blue").Delete
The following example displays the first item in the drop-down form field named "Color."

MsgBox ActiveDocument.FormFields("Color").DropDown.ListEntries(1).Name
Properties

Application property, Count property, Creator property, Parent property.

Methods

Add method (ListEntries collection), Clear method, Item method.