View Single Post
 
Old 05-27-2020, 04:35 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Quote:
Originally Posted by alex100 View Post
Today I spend about half an hour searching Google for Word highlighters, and while I found quite many, almost no one had the ability to use RGB colors. Except for Greg's Highlighter, they all used the 'HighlightColorIndex' property.
Hardly surprising, since few need anything more than the available highlight options.
Quote:
Originally Posted by alex100 View Post
Like me, I think most people who use such highlighters need to assign a single color to an entire list of keywords. Basically, you want ten keywords to be highlighted in red, 15 keywords in blue, and so on.

With this in mind, I think the best approach would be to have multiple arrays, each one with a corresponding color.

Something like this:

arrWords1 = Array("keyword1", "keyword2")
arrWords2 = Array("keyword1", "keyword2", "keyword3")
arrWords3 = Array("keyword1", "keyword2", "keyword3", "keyword4", "keyword5", "keyword6")

Then, the RGB list should basically assign one color to each array:

arrWords1: RGB (10, 175, 150)
arrWords2: RGB (74, 18, 188)
arrWords3: RGB (150, 175, 190)

What do you think?
I really can't see any benefit in that. And, contrary to what you suppose, implementation would require substantially more code. As it is, the Select Case statement can already be expanded to cover as many shading options as you want and, with only a trivial coding change, could be made to loop through those options multiple times if you have more array entries than shading options. Furthermore, if you want to have:
Quote:
ten keywords to be highlighted in red, 15 keywords in blue, and so on
all that would entail is building the Select Case statement with either:
• 15 blue, 15 red, and so on, then padding out the arrWords array with empty elements for keyword groups that have less than 15 items; or
• only the required number of colour definitions to match what's in the arrWords array,
either of which could be used in conjunction with specifying a range of values for 'i' in the Select Case statement. For example:
Code:
  Select Case i
    Case 0 - 14: RGB = wdColorRed
    Case 15 - 29: RGB = wdColorOrange
    Case 30 - 44: RGB = wdColorYellow
    Case 44 - 59: RGB = wdColorGreen
    Case 60 - 74: RGB = wdColorBlue
  End Select
Note: There's no need for the 'i' values to span equal size ranges in the Select Case statement; they're only used that way here to show how they might work in conjunction with the first bullet point.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote