Compartir por


Método Chart.Delete (Project)

Elimina un gráfico de un informe activo.

Sintaxis

expresión. Borrar

expresión Una variable que representa un objeto Chart.

Valor devuelto

Variant

Ejemplo

En el ejemplo siguiente se muestra un informe y, a continuación, se eliminan todos los gráficos del informe.

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

Vea también

Método Report.Deletedel objeto Chart

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.