Change Gradient Fill Colors of Bar Chart data points

  • Follow


I’m trying to modify the gradient fill colors of single data points on a bar 
charts (in Excel 2007).  The bar chart already has gradient fills defined 
manually.
I think I need to alter different child properties of .Interior, not the 
..ColorIndex property that would apply to non-gradient fills. I’ve waded 
through the object model and help file and tried all kind of syntaxes, but 
can’t get at the gradient without raising an error such as “Run-time error 
‘1004′: Application-defined or Object-defined error” or “Run-time error 
‘438′: Object doesn’t support this property or method”. Recording a macro of 
my setting this manually doesn’t help me since Excel does not record any of 
these steps in VBA!!
I have tried the following:
..Interior.Gradient.InteriorGradientStop(1).GradientStopColorIndex= RGB(a,b,c)
..Interior.InteriorGradientStop(1).GradientStopColorIndex= RGB(a,b,c)
..Interior.Gradient.Colorstops(1).ColorIndex = RGB(a,b,c)
(all the above with ActiveChart.SeriesCollection(1).Points(1) either 
referenced or selected)
..Gradient.ColorStops.Clear raises an error as well!

I’m sure this is something simple, but I just can’t get it!
Any help much appreciated.
Paul
0
Reply Utf 5/21/2010 3:46:01 PM

perhaps the likes of:


VBA Code:
--------------------
  

  
Sheets("Chart1").SeriesCollection(1).Points(4).Format.Fill.ForeColor.RGB = RGB(112, 222, 123)
  Sheets("Chart1").SeriesCollection(1).Points(4).Format.Fill.BackColor.RGB = RGB(0, 0, 5)
  
--------------------


?


-- 
p45cal

*p45cal*
------------------------------------------------------------------------
p45cal's Profile: http://www.thecodecage.com/forumz/member.php?u=558
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=204339

http://www.thecodecage.com/forumz

0
Reply p45cal 5/21/2010 11:20:05 PM


Excel 2007 Chart
Macro, fill color gradient.
http://c0718892.cdn.cloudfiles.rackspacecloud.com/05_21_10a.xlsm
Pdf preview:
http://www.mediafire.com/file/ewzzhy2yedd/05_21_10a.pdf
0
Reply Herbert 5/22/2010 1:16:41 AM

2 Replies
796 Views

(page loaded in 0.028 seconds)

Similiar Articles:
















7/23/2012 9:56:55 AM


Reply: