As some of you may already know the PERT Addin that was in Project for several versions was NOT included in Project 2010. The good news is that below we have the first version of some sample code you can use to add the feature back into the product! This first version does not use a form like the old one. It uses custom fields at the task level to store the Pessimistic, Optimistic and Most Likely estimates and the weights for each estimate. This is just a preliminary version. We hope to gather feedback and then release a future version of the code as a Visual Studio project that can be customized and used to create a Project 2010 Addin.
This code depends on using 7 task level custom fields:
The image below shows a Gantt Chart view with these fields inserted. In this example we see weights only on the first task. This is an option you can set in the code. If the option is set to ‘False’ then each task can have its own set of weights. Duration estimates are inserted for each task. The code at this point will estimate every task. (We could add the option to allow a project manager to specify which tasks should be estimated.)
To use this sample code in your own projects:
Now the code is ready to be used. All that is left is to insert the fields in the table above into a Gantt Chart view, enter your estimates and your weights (Remember that the weights must add up to 6!!) and then run the macro using the Quick Launch button you just added.
This is just a first pass at a sample for replacing the PERT functionality. Please email me (firstname.lastname@example.org) with your feedback.
Some things to think about:
One last thing: This is just sample code and should be thoroughly tested before you use it on a ‘production’ project.
Sub PERT()Dim tskT As TaskDim tskFirst As TaskDim FoundBadWeights As BooleanDim UseOneSetofWeights As Boolean
UseOneSetofWeights = TrueFoundBadWeights = False
CustomFieldRename FieldID:=pjCustomTaskDuration1, NewName:="Optimistic Duration"CustomFieldRename FieldID:=pjCustomTaskDuration2, NewName:="Most Likely Duration"CustomFieldRename FieldID:=pjCustomTaskDuration3, NewName:="Pessimistic Duration"CustomFieldRename FieldID:=pjCustomTaskNumber1, NewName:="Optimistic Weight"CustomFieldRename FieldID:=pjCustomTaskNumber2, NewName:="Most Likely Weight"CustomFieldRename FieldID:=pjCustomTaskNumber3, NewName:="Pessimistic Weight"CustomFieldRename FieldID:=pjCustomTaskText30, NewName:="PERT State"
If UseOneSetofWeights = True Then Set tskFirst = ActiveProject.Tasks(1) For Each tskT In ActiveProject.Tasks If Not (tskT Is Nothing) Then If tskT.PercentComplete = 0 And tskT.PercentWorkComplete = 0 Then If (tskFirst.Number1 + tskFirst.Number2 + tskFirst.Number3) = 6 Then tskT.Duration = ((((tskT.Duration1) * tskFirst.Number1) _ + ((tskT.Duration2) * tskFirst.Number2) _ + ((tskT.Duration3) * tskFirst.Number3)) / 6) tskT.Text30 = "Duration Calc'd: " & Now() Else tskT.Text30 = "Not Calc'd: Weights <> 6" FoundBadWeights = True End If Else tskT.Text30 = "Not Calc'd: Task In Progress or Complete" End If End If Next tskTElse For Each tskT In ActiveProject.Tasks If Not (tskT Is Nothing) Then If tskT.PercentComplete = 0 And tskT.PercentWorkComplete = 0 Then If (tskT.Number1 + tskT.Number2 + tskT.Number3) = 6 Then tskT.Duration = ((((tskT.Duration1) * tskT.Number1) _ + ((tskT.Duration2) * tskT.Number2) _ + ((tskT.Duration3) * tskT.Number3)) / 6) tskT.Text30 = "Duration Calc'd: " & Now() Else tskT.Text30 = "Not Calc'd: Weights <> 6" FoundBadWeights = True End If Else tskT.Text30 = "Not Calc'd: Task In Progress or Complete" End If End If Next tskTEnd IfIf FoundBadWeights = True Then MsgBox Prompt:="Some Tasks Weight Values were found to be incorrect." & _ Chr(13) & "Check the Text30 fields for details.", Buttons:=vbCritical, _ Title:="WorkPERT Weights Error"End IfEnd Sub