T
TomG
Hi,
I'm trying to stop resources being overallocated. Using VBA, I'm trapping
the Project Save event and not allowing it to happen if a resource has become
overallocated.
What I'd really like to do, is to tell the user which projects/tasks are
causing the overallocation.
The problem is that whilst I can identify an overallocated resource
(r.overallocated), there is no corresponding overallocated assignment in the
resource's assignments collection. i.e. from the code below, I get into the
"For Each a In r.Assignments" loop, but a.Overallocated is never True.
Would be grateful for any help or comments. I think I probably don't
understand the Overallocated property when it applies to a task or an
assignment (but I can't find any detailed help on it).
Thanks,
Tom
Private Sub App_ProjectBeforeSave(ByVal pj As Project, ByVal SaveAsUi As
Boolean, Cancel As Boolean)
Dim a As Assignment
Dim r As Resource
Dim t As Task
For Each r In ActiveProject.Resources
If r.Overallocated = True Then
For Each a In r.Assignments
If a.Overallocated = True Then
MsgBox "Overallocated Assignment!!"
End If
Next a
End If
Next r
I'm trying to stop resources being overallocated. Using VBA, I'm trapping
the Project Save event and not allowing it to happen if a resource has become
overallocated.
What I'd really like to do, is to tell the user which projects/tasks are
causing the overallocation.
The problem is that whilst I can identify an overallocated resource
(r.overallocated), there is no corresponding overallocated assignment in the
resource's assignments collection. i.e. from the code below, I get into the
"For Each a In r.Assignments" loop, but a.Overallocated is never True.
Would be grateful for any help or comments. I think I probably don't
understand the Overallocated property when it applies to a task or an
assignment (but I can't find any detailed help on it).
Thanks,
Tom
Private Sub App_ProjectBeforeSave(ByVal pj As Project, ByVal SaveAsUi As
Boolean, Cancel As Boolean)
Dim a As Assignment
Dim r As Resource
Dim t As Task
For Each r In ActiveProject.Resources
If r.Overallocated = True Then
For Each a In r.Assignments
If a.Overallocated = True Then
MsgBox "Overallocated Assignment!!"
End If
Next a
End If
Next r