I have created a pivot line chart in Access 2010. I am trying to use VBA to format the lines and markers so that my charts all look the same regardless of the series name. I can get everything to work except changing the marker color. Here is what I am using....
Private Sub Form_Load()
'Comp 1
Me.ChartSpace.Charts(0).SeriesCollection(0).Line.Color = RGB(0, 128, 255)
Me.ChartSpace.Charts(0).SeriesCollection(0).Line.Weight = 6
Me.ChartSpace.Charts(0).SeriesCollection(0).marker.Size = 6
Me.ChartSpace.Charts(0).SeriesCollection(0).marker.Style = 1
Me.ChartSpace.Charts(0).SeriesCollection(0).MarkerForegroundColor = vbRed
I have tried many different iterations for the marker color but I keep getting "run-time error '438': Object doesn't support this property or method" no matter how I try it. Any assistance is appreciated.
I updated code to
Private Sub Form_Load()
Dim p As Long
'Comp 1
With Me.ChartSpace.Charts(0).SeriesCollection(0)
.Line.Color = RGB(99, 66, 255)
.Line.Weight = 6
.marker.Size = 8
.marker.Style = 2
pc = .Points.Count
For p = 1 To pc
.Points(p).MarkerForegroundColorIndex = vbRed
Next
End With
but still have the same problem. I added the pc = .points.count
to verify accuracy. Everything works except changing the marker color.
Me.ChartSpace.Charts(0).SeriesCollection(0).Point.MarkerForegroundColor = vbRed
– Michael Byars.Points(0).MarkerForegroundColor
etc. and may therefore need to do a loop over thePoints
collection. – David Zemens