Deleting "Hard Returns" in document

G

Grammie

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?

Thanks,
Gram
 
O

Opinicus

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top