Export (0) Print
Expand All
Expand Minimize

Application.CreateComparisonReport Method (Project)

Creates a comparison report between two versions of a project.

Version Added: Project 2010

expression .CreateComparisonReport(FileName, TaskTable, ResourceTable, Items, Columns, ShowLegend)

expression An expression that returns an Application object.

Parameters

Name

Required/Optional

Data Type

Description

FileName

Optional

String

Full path and name of the project file to compare.

TaskTable

Optional

String

Name of the table to use for comparison in a task view.

ResourceTable

Optional

String

Name of the table to use for comparison in a resource view.

Items

Optional

PjCompareVersionItems

Specifies the type of items to compare.

Columns

Optional

PjCompareVersionColumns

Specifies whether to show only column data, only column differences, or both differences and data.

ShowLegend

Optional

Variant

If True, shows the legend in the comparison report.

Return Value

Boolean

The CreateComparisonReport method compares task or resource information, but not assignment information.

The following example demonstrate how to create a comparison report. The code first checks that a project is currently open, and then checks that either tasks or resources are in the project. The comparison report is based on cost tables, filtered for only changed task or resource cost information, with columns that display only the differences between tasks or resources. Finally, the comparison report is saved with a file name based on the current (first) project.

Sub ComparisonReport () 
 
If Projects.Count = 0 Then 
 MsgBox "You must have at least one active project open before you can compare projects.", _ 
 vbInformation 
 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.", _ 
 vbInformation 
 Exit Sub 
 End If 
End If 
 
' Get the name of the project to use for saving the comparison report. 
Dim currentProject As Project 
Set currentProject = ActiveProject 
 
Dim previousVersion As String 
previousVersion = "[full path to .mpp file to compare with the active project.]" 
 
CreateComparisonReport FileName:=previousVersion, _ 
 TaskTable:="Cost", _ 
 ResourceTable:="Cost", _ 
 Items:=pjCompareVersionItemsChangedItems, _ 
 Columns:=pjCompareVersionColumnsDifferencesOnly, _ 
 Showlegend:=True 
 
' Save the comparison report based upon the name of the first project. 
Dim comparisonReport As Project 
Set comparisonReport = ActiveProject 
ActiveProject.SaveAs currentProject & "_Compared.mpp" 
 
End Sub

Community Additions

ADD
Show:
© 2014 Microsoft