Report.Delete method (Project)

Deletes the report.

Syntax

expression.Delete

expression A variable that represents a 'Report' object.

Return value

Nothing

Example

The following example determines whether a report named Report 1 exists, and if so, deletes the report. If the report is active, change to another view before you delete it; otherwise, Project shows run-time error 1004: The table "Report 1" is in use and cannot be copied or deleted.

Sub DeleteAReport()
    Dim reportName As String
    
    reportName = "Report 1"
    
    If ActiveProject.Reports.IsPresent(reportName) Then
        ' To delete the active report, change to another view.
        ViewApplyEx Name:="&Gantt Chart"
        
        ActiveProject.Reports(reportName).Delete
    Else
        MsgBox Prompt:="No report name: " & reportName, Title:="Report delete error"
    End If
End Sub

See also

Report 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.