Chart.Delete method (Project)

Deletes a chart on an active report.

Syntax

expression.Delete

expression A variable that represents a Chart object.

Return value

Variant

Example

The following example displays a report, and then deletes all charts on the report.

Sub DeleteCharts()
    Dim chartReport As Report
    Dim chartShape As Shape
    Dim reportName As String
    
    ' Display a report.
    reportName = "Chart Report 1"
    Set chartReport = ActiveProject.Reports(reportName)
    chartReport.Apply
    
    ' Delete every chart on the report.
    For Each chartShape In chartReport.Shapes
        If chartShape.Type = msoChart Then
            Debug.Print "Deleting chart: '" & chartShape.Name _
                & "' from report: " & reportName
            chartShape.Delete
        End If
    Next chartShape
End Sub

See also

Chart Object Report.Delete 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.