Hi,
I'm trying to write some macro in VBA for Excel that manipulates with charts. I'm using ChartObject and I need to access them by name, so I rename them as shown in code sample below.
Expected result of the macro above is
but I get only
Does anyone know, what is the problem?
Does anyone know if there are any (more than "-") prohibited characters in ChartObject.Name property?
-xjena
I'm trying to write some macro in VBA for Excel that manipulates with charts. I'm using ChartObject and I need to access them by name, so I rename them as shown in code sample below.
Code:
Sub test()
' add two new chart objects and name them
Dim co As ChartObject
Set co = ActiveSheet.ChartObjects.Add(10, 10, 100, 100)
co.Name = "chart-1"
Set co = ActiveSheet.ChartObjects.Add(20, 20, 100, 100)
co.Name = "chart 2"
' loop through ChartOjects and show their names
For Each co In ActiveSheet.ChartObjects
Debug.Print co.Name
Next
End Sub
Expected result of the macro above is
Code:
chart-1
chart 2
but I get only
Code:
chart 2
Does anyone know, what is the problem?
Does anyone know if there are any (more than "-") prohibited characters in ChartObject.Name property?
-xjena