View Single Post
 
Old 10-11-2017, 10:00 AM
kevinbradley57 kevinbradley57 is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: Jul 2017
Posts: 89
kevinbradley57 is on a distinguished road
Default Remove consecutive empty paragraphs within existing macro

The code below removes a particular paragraph and the subsequent table. The paragraph is preceded by an empty paragraph, and the table is followed by an empty paragraph (both empty paragraphs are used as spacers). It works great, but after it runs there are two consecutive empty paragraphs. I need the code to remove one of those empty paragraphs. Help?

Code:
Sub DeletePriorAuditResults()
'
' DeletePriorAuditResults Macro
'
'
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "Prior Audit Results^p"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.MoveDown Unit:=wdLine, Count:=4, Extend:=wdExtend
    Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.Delete Unit:=wdCharacter, Count:=1
    Selection.Find.Execute
End Sub
Attached Files
File Type: dotm Audit Report Ver D1.6a.dotm (149.3 KB, 11 views)

Last edited by kevinbradley57; 10-11-2017 at 04:53 PM.
Reply With Quote