![]() |
|
#2
|
||||
|
||||
|
Try:
Code:
Sub Demo()
Dim i As Long, ArrNames, CCtrl As ContentControl
ArrNames = Array("A", "B", "C")
With ActiveDocument
For i = 0 To UBound(ArrNames)
On Error Resume Next
Set CCtrl = .SelectContentControlsByTitle(ArrNames(i))(1)
On Error GoTo 0
If CCtrl Is Nothing Then
.Range.InsertAfter " "
Set CCtrl = .ContentControls.Add(wdContentControlText, .Range.Characters.Last)
CCtrl.Title = ArrNames(i)
End If
Set CCtrl = Nothing
Next
End With
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
| Tags |
| content controls |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Show field shading in Content Control
|
ajanson | Word | 3 | 08-15-2016 04:49 PM |
| Have Text Entered in Content Control / PreDefined Field Populate Field in Footer | bzowk | Word | 1 | 04-14-2016 11:50 AM |
| Check Box Content Control when checked users are presented with an option | cryder | Word | 0 | 01-07-2016 05:11 AM |
Replace checkbox symbol with check box content control
|
canadansk | Word VBA | 5 | 04-01-2015 08:21 AM |
Adding auto text to end of content control field
|
ksigcajun | Word VBA | 4 | 10-13-2014 05:37 AM |