Compartir a través de


ListEntries.Item Method

Word Developer Reference

Returns an individual ListEntry object in a collection.

Syntax

expression.Item(Index)

expression   Required. A variable that represents a ListEntries collection.

Parameters

Name Required/Optional Data Type Description
Index Required Variant The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Return Value
ListEntry

Example

This example clears all the items from the drop-down form field named "Colors" and then adds two color names. The Item method is used to display the first color in the drop-down form field.

Visual Basic for Applications
  Sub ListEntryItem()
    Dim d As DropDown
    Set d = ActiveDocument.FormFields.Add _
        (Range:=Selection.Range, _
        Type:=wdFieldFormDropDown).DropDown
    With d.ListEntries
        .Add Name:="Black"
        .Add Name:="Green"
    End With
    MsgBox d.ListEntries.Item(1).Name
End Sub

See Also