View Single Post
 
Old 02-08-2024, 09:15 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, could you, please, post a sample of the problem document. I'm curious, because for me the code works smoothly: it leaves only one space before and after + and -. Maybe you want to delete single spaces also? Then use:
Code:
Sub MFindReplacePARA()

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