Chart.Delete 方法 (Project)

删除活动报表上的图表。

语法

表达式删除

expression:一个表示 Chart 对象的变量。

返回值

Variant

示例

以下示例显示一个报表,然后删除报表上的所有图表。

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

另请参阅

Chart 对象Report.Delete 方法

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。