View Single Post
 
Old 11-04-2019, 05:05 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
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 ofgmayor has much to be proud of
Default

Code:
Sub MultiReplace()
Dim StrOld() As Variant, StrNew() As Variant
Dim RngFind As Range, RngTxt As Range, i As Long
    StrOld = Array("qq", "ohb", "krp", "ljd", "§")
    StrNew = Array("<olp>", "<spn>", "<vocalized_noise>", "<noise>", "")
    Set RngTxt = Selection.Range
    For i = 0 To UBound(StrOld)
        Set RngFind = RngTxt.Duplicate
        With RngFind.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Text = StrOld(i)
            .Replacement.Text = StrNew(i)
            .Format = False
            .MatchWholeWord = True
            .MatchAllWordForms = False
            .MatchWildcards = False
            .Execute Replace:=wdReplaceAll
        End With
    Next
    Set RngFind = Nothing: Set RngTxt = Nothing
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