bs0d
Well-known Member
- Joined
- Dec 29, 2006
- Messages
- 622
Greetings all.
I've been working with a chart in VBA, and I have been getting some inconsistent results when applying a color to one of the series. The code is correct, and VBA executes it- however it is not applied.
If I try to color the series manually, I then get the following excel prompt:
Of course, if I click OK, it colors the series instantaneously. I believe this is preventing me from coloring the series, although I do not receive the prompt while the code is running. I do turn everything off, then back on upon completion however.
So my question is- am I correct in assuming this is the root cause? If so, what are the possible workarounds? Has anyone else had an issue like this?
It uses this default code to apply the color:
It also seems that no code beyond the point of foreColor.RGB is applied as well (only within the WITH statement), since the dash style is not applied either.
I've been working with a chart in VBA, and I have been getting some inconsistent results when applying a color to one of the series. The code is correct, and VBA executes it- however it is not applied.
If I try to color the series manually, I then get the following excel prompt:
Code:
Complex formatting that is applied to the selected chart may take a while to display. Do you want to continue using the formatting?
Of course, if I click OK, it colors the series instantaneously. I believe this is preventing me from coloring the series, although I do not receive the prompt while the code is running. I do turn everything off, then back on upon completion however.
So my question is- am I correct in assuming this is the root cause? If so, what are the possible workarounds? Has anyone else had an issue like this?
It uses this default code to apply the color:
Code:
With Sheets("Sheet 1").ChartObjects("myChart").Chart.FullSeriesCollection(1)
.MarkerStyle = -4142 'No markers
.Format.Line.Visible = msoTrue
.Format.Line.ForeColor.RGB = RGB(51, 204, 51)
.Format.Line.Transparency = 0
.Format.Line.Weight = 1.75
.Format.Line.DashStyle = msoLineDash
End With
It also seems that no code beyond the point of foreColor.RGB is applied as well (only within the WITH statement), since the dash style is not applied either.