ContentControlListEntry.Text property (Word)
Returns or sets a String that represents the display text of a list item for a drop-down list or combo box content control. Read/write.
Syntax
expression.Text
expression An expression that returns a ContentControlListEntry object.
Remarks
List entries must have unique display names. Attempting to change the Text property to a string that already exists in the list of entries raises a run-time error.
Example
The following example capitalizes the first character, if it is lowercase, in the display text of each list item.
Dim objCC As ContentControl
Dim objLE As ContentControlListEntry
Dim strFirst As String
For Each objCC In ActiveDocument.ContentControls
If objCC.Type = wdContentControlComboBox Or objCC.Type = wdContentControlDropdownList Then
For Each objLE In objCC.DropdownListEntries
strFirst = Left(objLE.Text, 1)
If strFirst = LCase(strFirst) Then
objLE.Text = UCase(strFirst) & Right(objLe.Text, Len(objLe.Text) - 1)
End If
Next
End If
Next
The following example sets the value for the list item based on the contents of the display text.
Dim objCc As ContentControl
Dim objLe As ContentControlListEntry
Dim strText As String
Dim strChar As String
Set objCc = ActiveDocument.ContentControls(3)
For Each objLE In objCC.DropdownListEntries
If objLE.Text <> "Other" Then
strText = objLE.Text
objLE.Value = "My favorite animal is the " & strText & "."
End If
Next
See also
ContentControlListEntry Object
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.