ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change Colors in Charts (https://www.excelbanter.com/excel-programming/418435-change-colors-charts.html)

Carlos Pedro

Change Colors in Charts
 
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..

Jon Peltier

Change Colors in Charts
 
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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Carlos Pedro" <Carlos wrote in message
...
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..




Carlos Pedro[_2_]

Change Colors in Charts
 

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
"Jon Peltier" wrote:

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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Carlos Pedro" <Carlos wrote in message
...
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..





Jon Peltier

Change Colors in Charts
 
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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Carlos Pedro" wrote in message
...

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
"Jon Peltier" wrote:

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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Carlos Pedro" <Carlos wrote in message
...
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..







Carlos Pedro[_2_]

Change Colors in Charts
 
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.


Jon Peltier

Change Colors in Charts
 
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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Carlos Pedro" wrote in message
...
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.





All times are GMT +1. The time now is 05:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com