Jon and Peter -
Thanks for the tips. I have used the .MarkerForegroundColorIndex as
well, and that doesn't seem to work (note - by the end of the message I
worked out a method that works, but I'd still love some insight to what
is going on). Using Peter's tip to change to xlNone, I can get the
background or foreground color to change to none, but I cannot get it
to change index repeatably. I put in some debug lines into the code:
Sub TestMarkerSize()
With ActiveChart.SeriesCollection(1)
Debug.Print "Start ForegroundColorIndex: ";
..MarkerForegroundColorIndex
Debug.Print "Start BackgroundColorIndex: ";
..MarkerBackgroundColorIndex
.MarkerBackgroundColorIndex = 12
.MarkerForegroundColorIndex = xlNone
Debug.Print "End ForegroundColorIndex: ";
..MarkerForegroundColorIndex
Debug.Print "End BackgroundColorIndex: ";
..MarkerBackgroundColorIndex
.MarkerSize = 5 + 10 * Rnd
End With
End Sub
The result of running this is mixed. It's difficult to figure all of it
out. But the trend seems to be that the first time I run the code on a
fresh plot, it works, I get:
Start ForegroundColorIndex: -4105
Start BackgroundColorIndex: -4105
End ForegroundColorIndex: -4142
End BackgroundColorIndex: 12
and the colors change appropriately (switching from xlAutomatic, which
I figured out was the -4105). However, all subsequent times that I run
it, it does not work (and does not seem to work at all in the context
of my larger code where I'm changing a lot of chart parameters.) If I
use the same plot as just above, and run the code again, changing the
color index to 18 from 12, I get:
Start ForegroundColorIndex: -4142
Start BackgroundColorIndex: 12
End ForegroundColorIndex: -4142
End BackgroundColorIndex: 12
And all subsequent efforts to change the index don't work. And like I
said, it doesn't seem to work at all in the context of my larger code
base.
To add to the fray, if I switch out the xlNone to be to the background
color index and set the foreground color index to 18, I get:
Start ForegroundColorIndex: -4142
Start BackgroundColorIndex: 12
End ForegroundColorIndex: 1
End BackgroundColorIndex: -4142
So, it seems very odd. However, while writing this message, I noticed
this pattern and tried the following code:
.MarkerForegroundColorIndex = xlNone
.MarkerBackgroundColorIndex = xlNone
.MarkerBackgroundColorIndex = 12
If I use that, I can now correctly set the background color index, but
I don't really understand why I need to reset it to xlNone every time
before setting it. So I have code that works now, but I'd still love
some understanding of it if anyone has anything to offer.
Thanks for the help!
Todd