View Single Post
 
Old 03-20-2024, 12:50 PM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 293
vivka is on a distinguished road
Default

Hi, Jakov93! There are several types of a dash: minus/hyphen (chr(45)), en-dash (chr(150)), and em-dash (chr(151). Try using each of them or alll of them at once with .MatchWildcards = True:
Code:
.text = "[" & Chr(45) & Chr(150) & Chr(151) & "]" & Chr(32)
Or if you surely want to keep the character and remove dash + space, use:
Code:
    With oRng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .text = "(?)- "
        .Replacement.text = "\1"
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
        .Execute Replace:=wdReplaceAll
    End With
Reply With Quote