RGB fill colours

D

DuncanL

Any ideas why the chart fill won't accept RGB colour values? Despite MSDN
saying a FillFormat should....
http://msdn2.microsoft.com/en-us/library/Aa173295(office.11).aspx

An example:

--------------------------------------------
bRGB = false
With oBook.ActiveChart.PlotArea.Fill

if (bRGB) then
' This doesn't work
.ForeColor.RGB = RGB(128, 0, 0)
.BackColor.RGB = RGB(170, 170, 170)
else
' This works
.ForeColor.SchemeColor = 15
.BackColor.SchemeColor = 16
end if

.TwoColorGradient msoGradientHorizontal, 1
End With
--------------------------------------------

Setting bRGB to true results in: Wrong number of arguments or invalid
property assignment: 'ForeColor.RGB'

This is being called from an external VBScript, not within Excel, if that
makes a difference.

Am I misreading how this should work? Suggestions or workarounds welcome.
Thanks.
 
A

Andy Pope

Hi,

The MSDN example is for Shapes not charts.
The RGB property for a chart element is readonly.

The help says:

RGB property as it applies to the ChartColorFormat object.
Returns the red-green-blue value of the specified color. Read-only Long.

Charts, unlike shapes, are restricted to the usual 56 colour palette of
excel.

Cheers
Andy
 

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