I, with the help of many in these news groups, developed a routine to do
this... see below
Mark
The first part bit of the code puts correct values in the summary tasks
The next bit of code sums up all the non-summary values then writes the sum
to the project summary task
this routine was written to work specifically with the "Baseline Work"
column. Without much effort you can make this routine work for any column -
I've commented in the code to make this routine "Generic" to any column of
numbers.
-=-=-=-=-=-
Sub SumSummaryBaselineWork() ' CHANGE TO "Sub SumSummary(ProjectField as
Long)
' WHEN CALLING - Call
SumSummary(pjTaskBaselineWork)
' (to sum the baseline
work column)
Dim OutlineIndent As Integer
Dim MaximumOutlineIndent As Integer
Dim TemporarySum As Double
Dim Children As Tasks
Dim Child As Task
Dim Activity As Task
Dim Total As Double
MaximumOutlineIndent = 0
Total = 0#
'
' Determine maximum number of outline levels
'
For Each Activity In ActiveProject.Tasks
If Not Activity Is Nothing Then ' check for null activities
If Activity.OutlineLevel > MaximumOutlineIndent Then
MaximumOutlineIndent = Activity.OutlineLevel
End If 'outline level
End If ' nothing
Next Activity
'
' Start at the lowest level and sum things up -
' this code properly sets the totals at the summary tasks (but not the
project summary task)
'
For OutlineIndent = MaximumOutlineIndent To 0 Step -1
For Each Activity In ActiveProject.Tasks
If Not Activity Is Nothing Then
If Activity.Summary Then
TemporarySum = 0
Set Children = Activity.OutlineChildren
For Each Child In Children
TemporarySum = TemporarySum + Child.BaselineWork
' CHANGE TO
' TemoprarySum = TemporarySum + Child.Getfield ProjectField
Next Child
Activity.BaselineWork = TemporarySum 'CHANGE TO
'Activity.SetField ProjectField, TemporarySum
End If ' summary
End If 'nothing
Next Activity
Next OutlineIndent
'
' now sum up the activities for the Summary Task
'
For Each Activity In ActiveProject.Tasks
If Not Activity Is Nothing Then
If Not Activity.Summary Then
Total = Total + Activity.BaselineWork
'CHANGE TO
'Total = Total + Activity.GetField ProjectField
End If
End If
Next Activity
ActiveProject.ProjectSummaryTask.BaselineWork = Total
' CHANGE TO
' activeproject.projectsummarytask.setfield ProjectField, Total
End Sub
--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc,
www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________
The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.
- Sir John Harvey-Jones