Change Colors in Charts

C

Carlos Pedro

Hello, I'm looking the equivelent in c++ for the following VBA code:

Sub change_series_color()
Set ch = Worksheets(1).ChartObjects(1)
Set objSeries = ch.Chart.SeriesCollection(1)
objSeries.Interior.Color = RGB(255, 127, 0)
End Sub

I can get the SeriesCollection of the chart, however, the Series Object
doesn't expose a property for its interior or it's interior color..
 
J

Jon Peltier

What kind of chart is it? Some series types do not have an interior
property.

Also, unless you're using Excel 2007, RGB(r, g, b) will apply the color in
Excel's palette which Excel decides is closest to the RGB values specified.
It might be close, or it might not. Check out color index to use any of the
56 colors in the Excel palette.

- Jon
 
C

Carlos Pedro

Hellol, I'm using a xl3DColumnStacked chart. And I do know that the colour
wont be exacly the one I chose, However I can't find a way to change the
color of the chart, Is there a reference for Excel development using COM and
C++=?

Best Regards,
Carlos Pedro
 
J

Jon Peltier

The vba code is fine. I guess you're asking for C++ help, which I cannot
provide. However, a quick Google search of 'Excel chart c++' turned up quite
a number of potentially helpful links.

- Jon
 
C

Carlos Pedro

I've googled "Excel Chart C++" and looked through the results, so far I got
nothing helpfull. There are even a few articles in MSDN about Excel C++
programming but nothing about changing a series color.

Is there another forum where I can ask about this? Some reference book about
c++ excel programming? I've even searched in amazon for a C++ Office
programming book and didn't find anything.
 
J

Jon Peltier

If the code exists in VBA, there has to be a generic way to convert it into
C++ syntax.

And yes, there are probably C++ forums that you could look into. Google
probably knows some of them.

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top