![]() |
|
#4
|
||||
|
||||
|
That would be the principle. However you could use wildcards with minimal iterations in a macro using wildcards Replace using wildcards e.g.
Code:
Sub Macro1()
Const sFind As String = "<ah[\!\?\,.]{1,}|<AH[\!\?\,.]{1,}|<Ah[\!\?\,.]{1,}"
Const sRepl As String = "^&"
Dim oRng As Range
Dim vFind As Variant
Dim i As Integer
vFind = Split(sFind, "|")
For i = 0 To UBound(vFind)
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(findText:=vFind(i), _
MatchWildcards:=True, _
ReplaceWith:=sRepl)
oRng.Font.Italic = True
oRng.Collapse 0
Loop
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 |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to Find & Highlight Words from List
|
DRD992 | Word VBA | 15 | 06-17-2023 05:06 AM |
Use VBA to find all cells with the same value and add to list
|
trevorc | Excel Programming | 2 | 11-24-2021 06:51 PM |
| Find - Replace Macro using a table list | mdw | Word | 0 | 08-01-2013 04:36 PM |
Macro that can find phrase and then find another and copy
|
jperez84 | Word VBA | 10 | 09-19-2012 04:48 PM |
How to write a macro to find a specified name in a list of data?
|
Jaffa | Excel | 1 | 10-23-2010 02:39 PM |