View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] beguerisse@gmail.com is offline
external usenet poster
 
Posts: 1
Default Problems changing Embedded Chart Name

I've been having problems naming some charts, whose name I will need
later in my macro.
Here is 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

Among other things, I want to know if a given chart exists like this:

Function ChartExists(hoja As String, name As String) As Boolean
Dim C As ChartObject
On Error Resume Next
Set C = Sheets(hoja).ChartObjects(name)
If Err = 0 Then
ChartExists = True
Else
ChartExists = False
End If
End Function


Anyone has any ideas???