PDA

View Full Version : RGB value of HighLightColorIndex



Petrini
07-16-2010, 07:27 AM
Hello, is there any way to convert a HighLightColorIndex to its RGB value (actually integer/long value)?
For example, if the highlight is yellow, HighLightColorIndex will return a 7.. but I expect to get a 65535.
The point is I'm working both with Excel and Word tables and I have to use compatible data types.
Creating an array of ColorIndexes and their RGB is just out of the question.
Thank you in advance!

fumei
07-16-2010, 11:52 AM
You are confusing two things.

wdColorIndex -> wdYellow = 7
wdColorIndex is an Enum totaling 19 items.

wdColor -> wdColorYellow = 65535
wdColor is an Enum totaling 60 items.

This means:MsgBox Selection.Range.HighlightColorIndex & vbCrLf & _
Selection.Font.Color & vbCrLf & _
Selection.Font.ColorIndex
can return three different values.

TonyJollans
07-16-2010, 01:55 PM
You could tease the values out of Word, but as there are so few of them, why do you say it is out of the question to hard code an array? - that's effectively what Word does, and is probably the best way to go.

fumei
07-16-2010, 01:57 PM
I would agree.

fumei
07-16-2010, 01:58 PM
Perhaps if you describe in more detail what the issue is, and where there seems to be problems, we can suggest something.