Freigeben über


ContentControlListEntries Collection

Word Developer Reference

The ContentControlListEntries collection contains ContentControlListEntry objects that represent the items in a drop-down list or combo box content control.

Remarks

Use the Add method to add an item to a drop-down list or combo box. The following example uses the Add method to add several list items to a new drop-down list content control.

Visual Basic for Applications
  Dim objCC As ContentControl
Dim objLE As ContentControlListEntry
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls.Add(wdContentControlDropdownList)

'List items objCC.DropdownListEntries.Add "Cat" objCC.DropdownListEntries.Add "Dog" objCC.DropdownListEntries.Add "Equine" objCC.DropdownListEntries.Add "Monkey" objCC.DropdownListEntries.Add "Snake" objCC.DropdownListEntries.Add "Other"

Use the Item method or the DropdownListEntries property of a ContentControl object to access an individual list item within a collection. The following example uses the Item method to access the third item in a list and change the display text.

Bb256553.vs_note(en-us,office.12).gif  Note
This example assumes that the first ContentControl object in the active document is a drop-down list or combo box.
Visual Basic for Applications
  Dim objCC As ContentControl
Dim objLE As ContentControlListEntry
Dim objMap As XMLMapping

Set objCC = ActiveDocument.ContentControls(1) Set objLE = objCC.DropdownListEntries.Item(3) objLE.Text = "Horse"

Use the Clear method to remove all items from a drop-down list or combo box. The following example clears all items from the first content control in the active document.

Bb256553.vs_note(en-us,office.12).gif  Note
This example assumes that the first content control in the active document is a drop-down list or combo box.
Visual Basic for Applications
  Dim objCC As ContentControl

Set objCC = ActiveDocument.ContentControls(1)

objCC.DropdownListEntries.Clear

See Also