View Single Post
 
Old 01-27-2023, 05:36 AM
davidvargas72 davidvargas72 is offline Windows 10 Office 2021
Novice
 
Join Date: Jan 2023
Posts: 6
davidvargas72 is on a distinguished road
Default Find-and-Replace Special Characters

Hello!
I'm having trouble with Find and Replace VBA macros:

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "%"
.Replacement.Text = " PERCENT"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAl
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "/"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAl

It will find the charaters but will not replace them. Please help!
Reply With Quote