Searching for empty paragraphs

Pinkham, Jim Jim.Pinkham at voith.com
Fri Oct 5 07:27:22 PDT 2007


The approach Stuart describes for Word will not mess up formatting.

I've used the following Word macro for the past several years to clean
up extra paragraphs and extra spaces. YMMV, but in Word 2000 and Word
2003, it has worked well for me. It may appear to have a few extra
iterations of the replace command than seems necessary at first blush,
but in my experience, they do no harm and tackle those documents truly
replete with extra paragraphs and spaces.

Sub SpaceAndParagraphRemover()
'
' SpaceAndParagraphRemover Macro
' Macro recorded 6/16/2003 by Jim Pinkham
'
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "  "
        .Replacement.Text = " "
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
        .Text = "^p^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
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll    
End Sub 

HTH,
Jim

-----Original Message-----
From: framers-bounces+jim.pinkham=voith.com at lists.frameusers.com
[mailto:framers-bounces+jim.pinkham=voith.com at lists.frameusers.com] On
Behalf Of Stuart Rogers
Sent: Friday, October 05, 2007 9:10 AM
To: Pat Christenson
Cc: framers at lists.frameusers.com
Subject: Re: Searching for empty paragraphs

Pat Christenson wrote:
> Hi all -
> 
> For years I've used the following wildcat search string to locate 
> empty
> paragraphs:
> 
> ^\p
> (start of line followed by paragraph ending)
> 
> It stopped working a couple releases ago (I believe in FM 7, maybe 
> earlier). Any suggestions?
> 
> If this doesn't work in FM, does anyone know a way of getting rid of 
> them in Word? I have a bunch of conversion work coming up.

In Word, search on ^p^p to find empty pgfs; replace with ^p. (A brief
experiment indicates it won't mess up formatting, but you'd be wise to
verify.)

HTH,

--
Stuart Rogers
Technical Communicator
Phoenix Geophysics Limited
Toronto, ON, Canada
+1 (416) 491-7340 x 325

srogers phoenix-geophysics com

"On the contrary."
-- Henrik Ibsen (last words, after a nurse said he "seemed a little 
better.")
_______________________________________________


You are currently subscribed to Framers as jim.pinkham at voith.com.

Send list messages to framers at lists.frameusers.com.

To unsubscribe send a blank email to 
framers-unsubscribe at lists.frameusers.com
or visit
http://lists.frameusers.com/mailman/options/framers/jim.pinkham%40voith.
com

Send administrative questions to listadmin at frameusers.com. Visit
http://www.frameusers.com/ for more resources and info.



More information about the framers mailing list