View Single Post
 
Old 05-20-2022, 12:21 AM
ranjan ranjan is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: May 2021
Posts: 80
ranjan is on a distinguished road
Default

Hi Macropod,

Its working fine but am facing small issue with this code. code is completely removing the text within the brackets having numbers..

Ex: If total is presented in negative value then its completely deleting the total value..

I want to delete the text having +,- or both combination withint the brackets.

Total (2345,99) This shouldnt be removed, but my code was removing the total value also, is there any possibility to remove text in the brackets having +,- or both combination.

Input:

ABC (1255+3456-211+4332)
DEF (123+456+678)
GHI (123-456-678)
TOTAL (123,456)

Output:

ABC
DEF
GHI
TOTAL (123,456)

Could you please review the below one:

Code:
Sub Test_Replace()
    With ActiveDocument.Content.Find
        .Text = "\(*\)"
        .Replacement.Text = ""
        .ClearFormatting
        .Replacement.ClearFormatting
        .MatchWildcards = True
        .Execute Replace:=wdReplaceAll
    End With
End Sub
Your Help is Highly Appreciated...
Reply With Quote