Chart.SaveChartTemplate method (Project)

Saves a custom chart template to the list of available chart templates or to a file.

Syntax

expression. SaveChartTemplate (bstrFileName)

expression A variable that represents a Chart object.

Parameters

Name Required/Optional Data type Description
bstrFileName Required String The name of the chart template.
bstrFileName Required String

Return value

Nothing

Remarks

By default, the SaveChartTemplate method saves the active chart to the user's chart template directory (for example C:\Users\username.DOMAIN\AppData\Roaming\Microsoft\Templates\Charts). If a UNC file path or URL is specified, the chart is saved to the specified location.

Example

The following example saves the chart template in the C:\Project\VBA\Samples\My chart template.crtx file.

Sub SaveATemplate()
    Dim chartShape As Shape
    Dim reportName As String
    
    reportName = "Simple scalar chart"
    Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
    
    chartShape.Chart.SaveChartTemplate "C:\Project\VBA\Samples\My chart template"
End Sub

See also

Chart Object SetDefaultChart Method

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.