View Single Post
 
Old 08-23-2021, 02:46 PM
drrr drrr is offline Windows 10 Office 2019
Novice
 
Join Date: Jul 2021
Posts: 9
drrr is on a distinguished road
Default a macro to replace paragraph mark with a space applies effect on paragraph marks after the selection

this should replace paragraph mark with a space on the selection only
but it applies to the selection and paragraph marks after the selection
it was created with record macro functionality

Code:
Sub clean()
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "^p"
        .Replacement.Text = " "
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchKashida = False
        .MatchDiacritics = False
        .MatchAlefHamza = False
        .MatchControl = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Reply With Quote