![]() |
|
#2
|
||||
|
||||
|
There are no 'lines' in a Word document. The following will highlight text formatted as wdColorAutomatic
Code:
With Selection.Find
.ClearFormatting
.Font.Color = wdColorAutomatic
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
Do While .Execute
Selection.Range.HighlightColorIndex = wdYellow
Loop
End With
Code:
Dim oRng As Range
Dim oPara As Paragraph
For Each oPara In ActiveDocument.Paragraphs
If oPara.Range.Font.ColorIndex = wdAuto Then
oPara.Range.HighlightColorIndex = wdYellow
End If
Next oPara
__________________
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 |
Help to Highlight a cell that has less than 5 characters
|
Cendrinne | Word VBA | 12 | 11-08-2020 11:05 PM |
Extract Line of Text w/ specific characters up to the paragraph character, send to Excel
|
dmarie123 | Word VBA | 10 | 07-20-2015 12:16 AM |
Highlight only the characters ER when it occurs in SEVERE.
|
norgro | Word VBA | 3 | 02-18-2013 05:14 PM |
| How to import a text file but skip the first line regardless of characters? | omahadivision | Excel Programming | 7 | 02-01-2013 08:30 PM |
Highlight the first X number of characters
|
14spar15 | Word | 1 | 11-13-2011 11:17 PM |