Changing colours in MSGraph using VBA

G

Guest

Hi, I’m creating charts using PP2003 with MSGraph 11.

I need to change the interior series colour of about 300 bar charts.

My problem is that the colour I need for SeriesCollection(1) is not a
standard colour but RGB(185, 220, 235).

I know how to changes the colour manually but I can’t figure out how to do
it in VBA

I have tried to define the interior colour direct by



ochart.SeriesCollection(1).Interior.Color = RGB(185, 220, 235)



I have also tried coding, click by click what I do manually, but it does not
work (see code below).

I don’t get any debug or error messages when I run the macro but the colour
does not change!!!

Please help!!!!!!



Sub Changecolor()

Dim ochart As Chart

Set ochart = ActivePresentation.Slides(1).Shapes(1).OLEFormat.Object

ochart.Colors(17) = RGB(185, 220, 235)

ochart.SeriesCollection(1).Interior.ColorIndex = 17

ochart.Application.Update

ochart.Application.Quit

End Sub
 
S

Steve Rindsberg

Hi, I’m creating charts using PP2003 with MSGraph 11.

I need to change the interior series colour of about 300 bar charts.

My problem is that the colour I need for SeriesCollection(1) is not a
standard colour but RGB(185, 220, 235).

I know how to changes the colour manually but I can’t figure out how to do
it in VBA

Can't be done, I'm afraid. MSGraph won't bark if you try, it'll just map your
specified color to the closest one it's got on hand.

One dodge is to fill with a bitmap instead of a solid color - the bitmap can be
a very small image of any color you like.

Another is to modify the PPT slide's color scheme then pick one of the MSGraph
indices that maps to the color scheme:

Fill, Accent, Accent & Link, Accent & Followed Link, Shadow, Title Text are
indices 17 through 22 in that order.

In other words, if you choose ColorIndex 17, you get whatever the current color
scheme's fill color is. And you can change the color scheme to whatever you
like.
 

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