View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
inquirer inquirer is offline
external usenet poster
 
Posts: 74
Default find name of a chart

I am writing some vba code in Excel 2003 to use the histogram function
to make histograms of data in a number of different worksheets.
I would like to delete all existing charts in a worksheet and then
create a histogram and then modify its properties. I have:

Application.Run
"ATPVBAEN.XLA!Histogram",ActiveSheet.Range("$D$2:$ D$733") _
, ActiveSheet.Range("$K$2"), ActiveSheet.Range("$J$3:$J$21"),
False, False _
, True, False
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 1").ScaleHeight 2.98, msoFalse,
msoScaleFromTopLeft
ActiveChart.Legend.Select
Selection.Delete

If there is an existing chart in the worksheet, this fails at
ActiveSheet.ChartObjects("Chart 1").Activate

so I would like to know how to get the name of the chart created by the
histogram.

Could anyone help please?
Thanks
Chris