Chart template help

SteveD

Board Regular
Joined
Feb 20, 2002
Messages
104
Hi all,

I have recorded the follwoing macro:

Sub mypiechart()

ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("'By State'!$D$1:$E$12")
ActiveChart.ChartType = xlColumnClustered
ActiveChart.ApplyChartTemplate ( _
"C:[***path***]\Templates\Charts\egPieChart.crtx" _
)
End Sub

When I recorded the macro, it applied a saved template and changes the column chart to a pie chart. When I run the macro, it seems that the template is not applied because it ends as a column chart.

Can anyone either let me know why this is not working and if I can do anything to fix it... or even better if there is code to directly apply the template to the chart as it is created?

Thank you for your help!
 

Some videos you may like

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

SteveD

Board Regular
Joined
Feb 20, 2002
Messages
104
OK, I think I've narrowed it down, but still need some help.

This is working fine if I use mt line chart format:
ActiveChart.ApplyChartTemplate ( _
"C:[***path***]\Templates\Charts\egLineChart.crtx" _
)

So.... I'm thinking that the way I'm adding the chart is somehow conflicting with trying to format it as a Pie chart.

Any help, insight, leads, etc. would be most appreciated.

Thanks,
Steve
 

Watch MrExcel Video

Forum statistics

Threads
1,123,474
Messages
5,601,872
Members
414,479
Latest member
Beau the dog

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top