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!
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!