View Single Post
 
Old 02-08-2024, 09:36 AM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 294
vivka is on a distinguished road
Default

Yacov, the following code will also delete empty paragraps:
Code:
Sub Spaces()

    With selection.range.Find
        .text = Chr(13) & "{2,}"
        .Replacement.text = Chr(13)
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchWildcards = True
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Execute Replace:=wdReplaceAll
        .text = " {1,}([+-]) {1,}"
        .Replacement.text = "\1"
        .Execute Replace:=wdReplaceAll
    End With
End Sub
Reply With Quote