Thread: naming charts
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default naming charts

As the chart is embedded you need to use

ActiveChart.parent.name = "HourChart"

Cheers
Andy

Mariano B. wrote:
Tushar,

I'm creating some charts and I want to name them as they are created for
further use on my macro, but i've been having trouble with it. I get an error
every time I try to rename the chart.
Here's my code :

Sub IPChart()
Charts.Add
With ActiveChart
.ChartType = xlColumnStacked
.SetSourceData Source:=Sheets("Recortadores").Range("B37:L94"),
PlotBy:=xlColumns
.Location xlLocationAsObject, name:="Recortadores"
End With

'To make sure there is a name, I always get "Recortadores Chart x"
MsgBox ActiveChart.name

ActiveChart.name = "HourChart"
End Sub


Sub prueba()
If ChartExists("Recortadores", "IPInfoChart") Then
MsgBox "ok"
End If
End Sub


I hope you can help me with this.
Greetings


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info