![]() |
|
#1
|
||||
|
||||
![]() 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 |
#2
|
|||
|
|||
![]()
Big thanks - worked like a charm!
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Writing a Macro which will search for the content of a cell rather than it's value | Sears36 | Excel Programming | 1 | 05-11-2017 07:55 AM |
Need help writing a macro to bring images to the front | readheads | Word | 0 | 11-23-2013 07:37 AM |
Writing a Macro in VBA | johnny51981 | Project | 1 | 06-22-2011 02:17 AM |
automatic start of macro + help on writing helper function | vsempoux | Word | 3 | 10-09-2009 03:01 AM |
Macro Writing | cweachter | Excel | 0 | 08-09-2008 08:30 PM |