Hi Marcel,
If your lines are terminated by manual line breaks or paragraph breaks, you don't actually need a macro for this - you can use
Word's Find/Replace function.
For example, to replace all lines terminated by manual line breaks, make the Find text:
^11<2 NICK>*^11
and the Replace Text:
^l
Similarly, to replace all lines terminated by paragraph breaks, make the Find text:
^13<2 NICK>*^13
and the Replace Text:
^p
In both cases, unless the found line is the 1st line in the document, it will be deleted - just the same as with Doug's macro. A
macro equivalent would be:
Sub ScratchMacro()
With ActiveDocument.Content.Find
.ClearFormatting
.Text = "^11<2 NICK>*^11"
.Replacement.ClearFormatting
.Replacement.Text = "^l"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
End Sub
I suspect this would be slightly faster than Doug's macro too