![]() |
|
#1
|
|||
|
|||
|
Hello
I need to change the color between the two codes for exampel :AAAA & BBBB its code in body text |
|
#2
|
||||
|
||||
|
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 |
|
#3
|
|||
|
|||
|
Please accept my best thanks
|
|
#4
|
|||
|
|||
|
I need to Creating headlines between the two codes
cut (codes and between codes) In some paragraphs there are two or more codes for headings for exampel : DDDD & EEEE its code in body text |
|
#5
|
|||
|
|||
|
i need help!
|
|
| Thread Tools | |
| Display Modes | |
|
|
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 |