Class ContentControlListEntry (Word VBA)

A ContentControlListEntry object represents a list item in a drop-down list or combo box content control. A ContentControlListEntry object is a member of the ContentControlListEntries collection for a ContentControl object.

The main procedures of class ContentControlListEntry are ContentControlListEntries.Add, Delete and Select

Set

To use a ContentControlListEntry class variable it first needs to be instantiated, for example

Dim ccl as ContentControlListEntry
Set ccl = ActiveDocument.Range.ContentControls(1).DropdownListEntries(Index:=1)

The following procedures can be used to set variables of type ContentControlListEntry: ContentControl.DropdownListEntries, ContentControlListEntries.Add and ContentControlListEntries.Item

For Each

Here is an example of processing the ContentControlListEntry items in a collection.

Dim cclListEntry As ContentControlListEntry
For Each cclListEntry In ActiveDocument.Range.ContentControls(1).DropdownListEntries
	If cclListEntry.Text = "Other" Then cclListEntry.Delete
Next cclDropdownListEntry

Methods

These are the main methods of the ContentControlListEntry class

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

Dim strText As String: strText =  
Dim ccl As ContentControlListEntry
Set ccl = ActiveDocument.Range.ContentControls(1).DropdownListEntries.Add(Text:=strText)

Delete - Deletes the specified item in a combo box or drop-down list content control.

ActiveDocument.Range.ContentControls(1).DropdownListEntries(1).Delete

Select - Selects the list entry in a drop-down list or combo box content control and sets the text of the content control to the value of the item.

ActiveDocument.Range.ContentControls(1).DropdownListEntries(1).Select

Properties

ContentControlListEntries.Count returns the number of items in the ContentControlListEntries collection.

Dim lngCount As Long
lngCount = ActiveDocument.Range.ContentControls(1).DropdownListEntries.Count

ContentControlListEntries.Parent returns an object that represents the parent object of the specified ContentControlListEntries object.

Dim objParent As Object
Set objParent = ActiveDocument.Range.ContentControls(1).DropdownListEntries.Parent

Index returns or sets a Long that represents the ordinal position of a content control list item in the collection of list items.

ActiveDocument.Range.ContentControls(1).DropdownListEntries(1).Index =

Parent returns an object that represents the parent object of the specified ContentControlListEntry object.

Dim objParent As Object
Set objParent = ActiveDocument.Range.ContentControls(1).DropdownListEntries(1).Parent

Text returns or sets a String that represents the display text of a list item for a drop-down list or combo box content control.

ActiveDocument.Range.ContentControls(1).DropdownListEntries(1).Text =

Value returns or sets a String that represents the programmatic value of an item in a drop-down list or combo box content control.

ActiveDocument.Range.ContentControls(1).DropdownListEntries(1).Value =