Pie Chart Colors

D

djf

I want to set the colors in a pie chart to the same colors everytime it runs.
I've tried recording an Excel macro and then converting it to Access but
could not get it to work. I've searched for VBA to do it and I've found code
like this:
With Me.ChartSpace.Charts(0)
.SeriesCollection(1).Interior.Color = RGB(255, 128, 128) 'peach
.SeriesCollection(2).Interior.Color = RGB(0, 255, 128) 'green
.SeriesCollection(3).Interior.Color = RGB(0, 128, 255) 'blue
.SeriesCollection(4).Interior.Color = RGB(128, 255, 255) 'turquoise
.SeriesCollection(5).Interior.Color = RGB(255, 255, 128) 'yellow
.SeriesCollection(0).Interior.Color = RGB(255, 0, 255) 'magenta
End With

I played with the code and got it to use the first color but it changed all
pie wedges to the same color and then errored out when it went to the next
series collection.

Does anyone know the VBA to set the colors?
 

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