What am I doing wrong here? I need to replace various characters with check boxes but get an error:
Sub ReplaceCheckboxes()
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Do
With Selection.Find
.Text = ChrW(13)
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Range.ContentControls.Add (wdContentControlCheckBox) ' error on this line
If Selection.Find.Execute = False Then Exit Do
Loop
Selection.HomeKey Unit:=wdStory
End Sub
I get "Object Doesn't Support This Action" on line Selection.Range.ContentControls.Add (wdContentControlCheckBox). I've also tried
Set objCC = ActiveDocument.ContentControls.Add(wdContentControlCheckBox)
and
ActiveDocument.ContentControls.Add wdContentControlCheckBox, Selection.Range
I guess I'm misunderstanding how the find method works.