Excel 2003 had a simple …interior.colorindex and only 56 numbers. But, this is changed with Excel 2010 for better control.
Now while developing a program.. which is supposed to copy a cell color (in VBA) and put the same color of the cell to an Excel Shape depending on the cell contents… i was lost with several different objects like this:
For the Cell:
Sheets("Config").Range("E1").Interior.ThemeColor = 10
Sheets("Config").Range("E1").Interior.TintAndShade = -0.249977111117893
For the Shape:
Activesheet.shapes("R3").fill.forecolor.objectthemecolor = 7
Activesheet.shapes("R3").fill.forecolor.brightness = 0.6
Activesheet.shapes("R3").fill.forecolor.schemecolor = 42
Activesheet.shapes("R3").fill.forecolor.tintandshade (and this doesn't even work)
I have found a better simpler way which don’t require all the above different naming..
All you need is:
which will return a long… like this for example: 682978 (of the hex color in decimal)
And, you can set the color for the shape like this:
Other useful notes are:
and, for printing in console