Project) (Chart.Delete 方法

刪除使用中報表上的圖表。

語法

運算式。刪除

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

另請參閱

圖表物件Report.Delete 方法

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。