The folowing code will change the #1 chart series color. It works fine for a BAR chart but if you change the chart type to a LINE chart the code excutes fine but has no effect on the series color. Any one why?
Please comment
thankz tony
Sub ChangeSeries1Color()
Dim MyChartObject As ChartObject
Dim MyChart As Chart
Dim MySeries As Series
Dim MyChartFormat As ChartFormat
Dim MyFillFormat As Line
Dim MyColorFormat As ColorFormat
' Create the objects
Set MyChartObject = ActiveSheet.ChartObjects("Chart 7")
Set MyChart = MyChartObject.Chart
Set MySeries = MyChart.SeriesCollection(1)
Set MyChartFormat = MySeries.Format
Set MyFillFormat = MyChartFormat.Line
Set MyColorFormat = MyFillFormat.ForeColor
' Change the color
MyColorFormat.RGB = vbGreen
End Sub
Please comment
thankz tony
Sub ChangeSeries1Color()
Dim MyChartObject As ChartObject
Dim MyChart As Chart
Dim MySeries As Series
Dim MyChartFormat As ChartFormat
Dim MyFillFormat As Line
Dim MyColorFormat As ColorFormat
' Create the objects
Set MyChartObject = ActiveSheet.ChartObjects("Chart 7")
Set MyChart = MyChartObject.Chart
Set MySeries = MyChart.SeriesCollection(1)
Set MyChartFormat = MySeries.Format
Set MyFillFormat = MyChartFormat.Line
Set MyColorFormat = MyFillFormat.ForeColor
' Change the color
MyColorFormat.RGB = vbGreen
End Sub