ContentControlListEntry.Text Property

Word Developer Reference

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.

Visual Basic for Applications
  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.<strong class="bterm">Text</strong> = UCase(strFirst) &amp; 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.

Visual Basic for Applications
  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