View Single Post
 
Old 05-26-2020, 02:13 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

1. You can't - only the 16 indexed highlights can be used.
2. Insert:
Code:
    .Highlight = False
before:
Code:
    .Replacement.Highlight = True
For the situation where you're highlighting both 'music' and 'great music', process 'great music' before you process 'music'.

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
This gives 14 highlights, omitting black & white.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote