View Single Post
 
Old 05-02-2024, 01:01 PM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Hi! The folowing code will replace all 3 and more paragraph signs with two ones in the selected range:
Code:
Sub Deleemptyparagraphs()
selection.Find.ClearFormatting
selection.Find.Replacement.ClearFormatting
    With selection.Find
        .text = Chr(13) & "{3;}"
        .Replacement.text = "^p^p"
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchWildcards = True
        .MatchAllWordForms = False
        .MatchSoundsLike = False
    End With
selection.Find.Execute Replace:=wdReplaceAll
End Sub
Reply With Quote