How do I get the HEX or RGB numbers for the colours used in Excel Chart Style 2

Hi,

I wish to get the HEX or RBG numbers for the colours that are used in the Excel 2007's chart style 2.

This is the chart style as shown in the sample sheet below.  I have used the macro recorder but that just applies activechart.chartstyle = 2

I am really only interested in the colour of the different data series shown on the example.  Green, Blue, Purple and Red etc.

Thanks
ColourStyle.xlsx
LVL 17
wobbledAsked:
Who is Participating?
 
Rory ArchibaldCommented:
OK - for example:
Sub GetRGB()
    Dim n As Long
    With ActiveChart.SeriesCollection
        For n = 1 To .Count
            Debug.Print .Item(n).Border.Color
        Next n
    End With
End Sub

Open in new window


this will output the values to the Immediate Window in the VBE. (you need to select the chart first)
0
 
Rory ArchibaldCommented:
Do you actually need the individual R, G and B component values, or just the overall RGB number?
0
 
wobbledAuthor Commented:
The overall RBG should be fine

I'm trying to recreate charts in WPF using a similar style to that available in Excel so I can work with any colour codes that Microsoft accepts
0
 
kgerbChief EngineerCommented:
Whenever I need to get RGB values for something I use Pixie.  It works well.

Kyle
0
 
wobbledAuthor Commented:
Thanks - did the job fine
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.