You've got two minor issues that are preventing your code from working right.
Try using vbCr to insert the carriage returns rather than vbLf.
Secondly, you need to be explicit about the fact that the paragraph format is to be applied to the replacement text, and isn't part of what you're searching for.
Try this:
Selection.Find.ClearFormat
With Selection.Find
.Text = "_join_the_heading_with_th
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
With .Replacement
.Text = vbCr & vbCr
.ParagraphFormat.KeepWithN
End With
.Execute Replace:=2
End With
Selection.Find.Execute Replace:=1
End Sub
Main Topics
Browse All Topics





by: JOrzechPosted on 2007-02-20 at 09:33:58ID: 18572227
I guess my first question is why not just use styles to do this rather than VB?