![]() |
|
#4
|
||||
|
||||
|
1. You can't - only the 16 indexed highlights can be used.
2. Insert: Code:
.Highlight = False Code:
.Replacement.Highlight = True And, to vary the highlighting, for each expression, use something like: Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range, arrWords, i As Long, h As Long
arrWords = Array("keyword1 & keyword2", "keyword1", "keyword3")
Set Rng = Selection.Range
With Rng
.Paste
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindStop
.Replacement.Text = "^&"
.Highlight = False
.Replacement.Highlight = True
For i = 0 To UBound(arrWords)
h = i Mod 14
If h < 6 Then
h = h + 2
Else
h = h + 3
End If
Options.DefaultHighlightColorIndex = h
.Text = arrWords(i)
.Execute Replace:=wdReplaceAll
Next
End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| I am trying to delete text of any format between two bold, recurring keywords or symbols | qubie | Word VBA | 8 | 03-04-2020 03:20 PM |
how do I make pasted text the same size as the text it's being pasted into?
|
David Lee | Word | 6 | 08-16-2015 10:46 AM |
Help with finding multiple keywords in a single document then highlight
|
navyguy | Word | 2 | 01-03-2014 12:48 PM |
| Trying to highlight pasted text in a macro | goldengate | Word VBA | 0 | 09-14-2010 09:41 PM |
| find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |