ContentControlListEntries.Add method (Word)

Adds a new list item to a drop-down list or combo box content control and returns a ContentControlListEntry object.

Syntax

expression.Add (Text, Value, Index)

expression An expression that returns a ContentControlListEntries object.

Parameters

Name Required/Optional Data type Description
Text Required String Specifies the display text for the list item. Corresponds to the Text property for a ContentControlListEntry object.
Value Optional String Specifies the value of the list item. Corresponds to the Value property for a ContentControlListEntry object. If omitted, the Value property is equal to the Text property.
Index Optional Long Specifies the ordinal position of the new item in the list. If an item exists at the position specified, the existing item is pushed down in the list. If omitted, the new item is added to the end of the list.

Return value

ContentControlListEntry

Remarks

List entries must have unique display names. Attempting to add a list item that already exists raises a run-time error.

Example

The following code example creates a new drop-down list content control and then adds several items to it.

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"

See also

ContentControlListEntries Collection

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.