Link to home
Start Free TrialLog in
Avatar of Lawlords
LawlordsFlag 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
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lawlords

ASKER

Thanks very much GrahamSkan