PDA

View Full Version : How to name a chart that is not a chart sheet?



macroppt123
06-01-2011, 06:31 AM
Hi,

I am having a hard time giving a name to a chart. Hence the below copy paste code does not recognize the chart as the chart does not have a name.

slidenum = 10
'copy_chart(sheet, chart_name, slide, aheight, awidth, atop, aleft,lockaspect,vscale)
copy_chart "HFI", "HFI Apr-10 Apr-11", slidenum, 170, 160, 105, 70, msoFalse, 1

I tried the below code to give the chart a name but in vain.

ActiveChart.Parent.Name = "HFI Apr-10 Apr-11"

The Name box on the left next to the formula bar has a value of 12 when I click on the chart.

I tried clicking shift and giving a name in the name box but the chart needs to be created as a chart sheet.

What do you suggest I do? Create the chart as a chart sheet?

Thanks for your help.

Best Regards,
macroppt123

macroppt123
06-01-2011, 06:59 AM
I added the below code meant for slide 10 in pasting to powerpoint and it changd the chart name of a chart which is the lat chart in slide 9.

Now I am unable to change this back to it's original name which is
"VA Retail 09Q4"


ActiveChart.Parent.Name = HFI Apr-10 Apr-11

macroppt123
06-01-2011, 07:33 AM
I want to activate the sheet named "HFI" in order to name the chart. I tried the below code but I get an error that this is not supported.

ActiveSheet("HFI").Activate
ActiveChart.Parent.Name = "HFI Apr-10 Apr-11"

macroppt123
06-01-2011, 07:40 AM
I was able to activate the sheet using the below. But when giving a name to the chart, I get a message "Object variable or with block variable not set" Run time error 91.

Sheets("HFI").Activate
ActiveChart.Name = "HFI Apr-10 Apr-11"

frank_m
06-01-2011, 10:04 AM
Try:
Sheets("HFI").ChartObjects("WhateverTheNameIsNow").Name = "NewName"