Hi folks, I am recording macros in Word as an introduction to the language. I made this one this morning but it doesn't work for some reason. It's designed to insert a placeholder at the start of every paragraph of a certain style.
Sub insertplaceholder3()
'
' insertplaceholder3 Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Customer Question Body Copy" _
)
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveDown Unit:=wdParagraph, Count:=1
Selection.TypeText Text:="<<response placeholder>>"
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend
Selection.Style = ActiveDocument.Styles("Body Copy")
Options.DefaultHighlightColorIndex = wdYellow
Selection.Range.HighlightColorIndex = wdYellow
End Sub
When I run the macro in Word, VBA pops up with an error message that says 'Expected: line number or label statement or end of statement.'
Is there an easy way to fix this?
Thanks
G