M
Mark Durrenberger
Thank Jack D for writing this little ditty for summing up activities at
summary tasks.
Now I'd like a single routine for ANY text column... The version you see
below works for only Text14...
Sub SumSummaryText14()
Dim OutlineIndent As Integer
Dim MaximumOutlineIndent As Integer
Dim TemporarySum As Double
Dim Children As Tasks
Dim Child As Task
Dim Activity As Task
MaximumOutlineIndent = 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
'
For OutlineIndent = MaximumOutlineIndent To 0 Step -1
For Each Activity In ActiveProject.Tasks
If Not Activity Is Nothing Then
If Activity.Summary And (Activity.OutlineLevel = OutlineIndent) Then
TemporarySum = 0
Set Children = Activity.OutlineChildren
For Each Child In Children
TemporarySum = TemporarySum + val(Child.Text14)
Next Child
Activity.Text14 = CStr(TemporarySum)
End If ' summary
End If 'nothing
Next Activity
Next OutlineIndent
End Sub
One suggestion is to use a case statement - I don't know how to make that
work - sure I understand the case statement
Call SumSummary("Text20")
Sub SumSummary(Column as string)
Select Case Column
Case "Text20" ? What goes here?
Case "Text19" ? What goes here?
Case "Text18" ? What goes here?
End Select
Thanks,
Mark
summary tasks.
Now I'd like a single routine for ANY text column... The version you see
below works for only Text14...
Sub SumSummaryText14()
Dim OutlineIndent As Integer
Dim MaximumOutlineIndent As Integer
Dim TemporarySum As Double
Dim Children As Tasks
Dim Child As Task
Dim Activity As Task
MaximumOutlineIndent = 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
'
For OutlineIndent = MaximumOutlineIndent To 0 Step -1
For Each Activity In ActiveProject.Tasks
If Not Activity Is Nothing Then
If Activity.Summary And (Activity.OutlineLevel = OutlineIndent) Then
TemporarySum = 0
Set Children = Activity.OutlineChildren
For Each Child In Children
TemporarySum = TemporarySum + val(Child.Text14)
Next Child
Activity.Text14 = CStr(TemporarySum)
End If ' summary
End If 'nothing
Next Activity
Next OutlineIndent
End Sub
One suggestion is to use a case statement - I don't know how to make that
work - sure I understand the case statement
Call SumSummary("Text20")
Sub SumSummary(Column as string)
Select Case Column
Case "Text20" ? What goes here?
Case "Text19" ? What goes here?
Case "Text18" ? What goes here?
End Select
Thanks,
Mark