Avatar of Lawlords
Lawlords
Flag for Hong Kong asked on

Problem in removing the blank paragraphs

Dear all,

I have written the code to remove the unnecessary blank paragraphs between the tables so as to keep a single paragraph between any 2 tables. However, there must be some logical errors in mycode causing the following problems:

1. Most of the unnecessary blank paragraphs were removed except 2 continues blank  paragraph remained
2. The code can't stop once initialzed

Thanks for any asstance in advance

Do

    Selection.find.ClearFormatting
    Selection.find.Replacement.ClearFormatting
    With Selection.find
        .Text = "^p^p"
        .Replacement.Text = "^p"
        .Forward = True
        .Wrap = wdFindContinue 'wdFindAsk
    End With
    Selection.find.Execute Replace:=wdReplaceAll


Loop Until Selection.find.Found = False

Open in new window

Sample.doc
Microsoft Word

Avatar of undefined
Last Comment
Lawlords

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
GrahamSkan

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Lawlords

ASKER
Thanks very much GrahamSkan
Your help has saved me hundreds of hours of internet surfing.
fblack61