View Single Post
 
Old 11-19-2021, 04:44 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,105
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You haven't selected anything, so a search in Selection.Range will not find anything.
Try the following:
Code:
Sub findM()
Dim strfind() As Variant
Dim strreplace() As Variant
Dim i As Integer
    strfind = Array("cE", "km")
    strreplace = Array("c?\u", "?")
    For i = 0 To UBound(strfind)
        Selection.HomeKey wdStory
        With Selection.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Text = strfind(i)
            .Format = True
            .Forward = True
            .MatchAlefHamza = False
            .MatchWildcards = False
            .MatchCase = True
            .MatchWholeWord = False
            .Replacement.Text = strreplace(i)
            .Execute Replace:=wdReplaceAll
        End With
    Next i
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote