![]() |
|
|
|
#1
|
||||
|
||||
|
The following macro should do the trick
Code:
Sub Macro1()
Const CodeA As String = "AAAA"
Const CodeB As String = "BBBB"
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(FindText:=CodeA & "*" & CodeB, MatchWildcards:=True)
oRng.Font.ColorIndex = wdRed
oRng.Collapse 0
Loop
End With
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(FindText:=CodeA)
oRng.Font.ColorIndex = wdAuto
oRng.Collapse 0
Loop
End With
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(FindText:=CodeB)
oRng.Font.ColorIndex = wdAuto
oRng.Collapse 0
Loop
End With
lbl_Exit:
Set oRng = Nothing
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Spellchecker Macro Provided by MVP Not Checking for Grammar
|
PSSMargaret | Word VBA | 2 | 06-09-2016 04:02 AM |
RGB color codes?
|
regwitt | Excel Programming | 2 | 01-06-2015 04:51 PM |
Color codes as background
|
Anderso | Excel | 1 | 12-19-2014 11:53 PM |
| Converting color codes in VBA | Ulodesk | Word VBA | 7 | 11-24-2014 04:15 AM |
Codes for Word Textbox Font Color?
|
tinfanide | Word VBA | 7 | 10-23-2012 03:13 PM |