Sub Demo()
Application.ScreenUpdating = False
Dim CCtrl As ContentControl, bFld As Boolean, i As Long, j As Long
For Each CCtrl In ActiveDocument.ContentControls
bFld = False
With CCtrl
If InStr(1, .PlaceholderText.Value, "SELECT", vbTextCompare) > 0 Then
bFld = True: i = i + 1:
.SetPlaceholderText Text:=Replace(.PlaceholderText.Value, "SELECT", "Field_" & i, , , vbTextCompare)
ElseIf InStr(1, .PlaceholderText.Value, "INSERT", vbTextCompare) > 0 Then
bFld = True: i = i + 1:
.SetPlaceholderText Text:=Replace(.PlaceholderText.Value, "INSERT", "Field_" & i, , , vbTextCompare)
End If
Select Case .Type
Case wdContentControlRichText, wdContentControlText
If InStr(1, .Range.Text, "SELECT", vbTextCompare) > 0 Then
If bFld = False Then
bFld = True: i = i + 1
End If
.Range.Text = Replace(.Range.Text, "SELECT", "Field_" & i, , , vbTextCompare)
ElseIf InStr(1, .Range.Text, "INSERT", vbTextCompare) > 0 Then
If bFld = False Then
bFld = True: i = i + 1
End If
.Range.Text = Replace(.Range.Text, "INSERT", "Field_" & i, , , vbTextCompare)
End If
Case wdContentControlDropdownList, wdContentControlComboBox
For j = 1 To .DropdownListEntries.Count
If InStr(1, .DropdownListEntries(j).Text, "SELECT", vbTextCompare) > 0 Then
If bFld = False Then
bFld = True: i = i + 1
End If
.DropdownListEntries(j).Text = Replace(.DropdownListEntries(j).Text, "SELECT", "Field_" & i, , , vbTextCompare)
ElseIf InStr(1, .DropdownListEntries(j).Text, "INSERT", vbTextCompare) > 0 Then
If bFld = False Then
bFld = True: i = i + 1
End If
.DropdownListEntries(j).Text = Replace(.DropdownListEntries(j).Text, "INSERT", "Field_" & i, , , vbTextCompare)
End If
Next
End Select
End With
Next
Application.ScreenUpdating = True
End Sub