ssakthivel
New Member
- Joined
- May 13, 2008
- Messages
- 5
I have a couple of charts in my worksheet. I am trying to modify the chart titles and the chart legends through vba. I am able to access and update chart titles. However legend series names are inaccessible. I guess I am not doing something right. Here is the simplified version of my code:
In the watch window, se.Name is <unable to="" get="" the="" name="" property="" of="" series="" class=""><unable to="" get="" the="" name="" property="" of="" series="" class="">"Unable to get the Name property of the Series class".
I tried accessing se.Name after activating the chart by including the line o.Activate and o.Chart.Activate hoping that might help. Actually I tried o.Activate first and then tried o.Chart.Activate. No dice.
Can anyone see what I am missing in the above code?
Thanks</unable></unable>
Code:
Dim o As ChartObject
Dim se As Series
For Each o In mySheet.ChartObjects
'Chart Title
rngChartName = o.Chart.ChartTitle.Text
o.Chart.ChartTitle.Text = rngNewChartName.Value
'Legend
For Each se In o.Chart.SeriesCollection
rngSerialName = se.Name
se.Name = rngLegendNewName
'Advance the ranges
Set rngSerialName = rngSerialName.Offset(1, 0)
Set rngLegendNewName = rngLegendNewName.Offset(1, 0)
Next
Next
I tried accessing se.Name after activating the chart by including the line o.Activate and o.Chart.Activate hoping that might help. Actually I tried o.Activate first and then tried o.Chart.Activate. No dice.
Can anyone see what I am missing in the above code?
Thanks</unable></unable>