Grammie said:
Help. I need to know how to delete a bunch of lines in a
document
using either "find" "replace" or a macro to do it. I'm
not sure about
making a macro. Can anyone help me?
This will pretty much accomplish what you want to do:
<quote>
Sub Squeeze()
'
' Squeeze Macro
' Macro recorded 19.11.00 by Opinicus
'
Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " ^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "^p "
.Replacement.Text = "^p "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
</quote>
The trick is making sure you get rid of all the multiple
spaces and the spaces before and after the carriage return
(^p) before zapping the multiple returns.