Chart.Export method (Project)

Exports a chart in a graphic file format.

Syntax

expression.Export (bstr, varFilterName, varInteractive)

expression A variable that represents a Chart object.

Parameters

Name Required/Optional Data type Description
bstr Required String The path and name of the exported file.
varFilterName Optional Variant The language-independent name of the graphic filter as it appears in the registry ( HKLM\\SOFTWARE\Wow6432Node\Microsoft\Shared Tools\Graphics Filters).
varInteractive Optional Variant True to display the dialog box that contains the filter-specific options, if any. If varInteractive is False, Project uses the default values for the filter. The default value is False.
bstr Required String
varFilterName Optional Variant
varInteractive Optional Variant

Return value

Boolean

Remarks

The Export method overwrites an existing read/write file of the same name.

Example

The following example exports the chart as a Portable Network Graphics (.png) file.

Sub ExportChart()
    Dim chartShape As Shape
    Dim reportName As String
    Dim fileFormat As String
    Dim fileName As String
    
    fileFormat = "PNG"
    fileName = "C:\Project\VBA\Samples\SimpleChart.png"
    
    reportName = "Simple scalar chart"
    Set chartShape = ActiveProject.Reports(reportName).Shapes(1)
    
    If (chartShape.Chart.Export(bstr:=filename, varFilterName:=fileFormat)) Then
        Debug.Print "Exported chart: " & filename
    End If
End Sub

See also

Chart Object

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.