View Single Post
 
Old 03-01-2024, 08:44 AM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 293
vivka is on a distinguished road
Default

Hi! Try this one:
Code:
Sub RemovePara()
    Dim oRng   As range
    If Len(selection.range) = 0 Then
        MsgBox "Select the text first", vbCritical
        Exit Sub
    End If
    Set oRng = selection.range

    With oRng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .text = "([!.])" & Chr(13)
        .Replacement.text = "\1 "
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
        .Execute Replace:=wdReplaceAll
    End With
End Sub
Reply With Quote