Table of contents
Collapse the table of content
Expand the table of content

Application.CompareProjectVersions Method (Project)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Displays the Compare Project Versions dialog box to compare two versions of a project.


expression. CompareProjectVersions

expression An expression that returns an Application object.

Return Value



The CompareProjectVersions method is equivalent to the Compare Projects command in the Reports group of the Project tab on the Ribbon. If you want programmatic control of the project comparison feature (such as whether difference columns are displayed), use the CreateComparisonReport method.


The following example checks whether a project is open before calling the CompareProjectVersions method. If a project is open, the code checks whether there are either tasks or resources in the project before calling the method.

Sub CompareVersions () 
    If Projects.Count = 0 Then 
        MsgBox "You must have at least one project open before you can compare projects." 
    Exit Sub 

    ElseIf ActiveProject.Tasks.Count = 0 Then 
        If ActiveProject.ResourceCount = 0 Then 
            MsgBox "There are no task or resources in the current project." &; vbCrLf &; _ 
                "Open a project with either tasks or resources before creating a comparison report.", _ 
            Exit Sub 
        End If 
    End If 

End Sub
© 2018 Microsoft