A
alex
Hi,
Context:
Get an object resource from a task => It's ok
Put the object resource in an array => I think ok, but not sure
Convert the object from array as resource
I try to modify the behavior of project for the remaining work
So I decide to modify the planning according with the baseline.
I browse the resource of one task because I should save the work and actual
work.
But I encountered any issue.
When I see with the spy in vba the object R is equal to 1. I click on the
button expand and I can see the details.
So I expected to put the object R in my array and browse R later.
But I see with the spy MyResourcesTab(i) = 1. so I think it's because VBA in
project don't manage really the object.
I try to use CTYPE but is not exist and CVAR doesn't apply here.
So before to use two arrays and add the work in the first and the actual
work in the second, I ask you if you have already
work with object and know how I can solve it.
ReDim MyResourcesTab(T.Resources.Count)
For Each R In T.Resources
MyResourcesTab(i) = R
MyR = CVar(MyResourcesTab(i))
i = i + 1
Next R
######################"CODE##############################""
Sub PlanificationInitiale()
Dim T As Task
Dim R As Resource
Dim i As Integer
i = 0
Dim numberTab As Integer
Dim MyResourcesTab()
For Each T In ActiveProject.Tasks
If Not (T Is Nothing) Then
If (T.Name = "Tache2") Then
ReDim MyResourcesTab(T.Resources.Count)
For Each R In T.Resources
MyResourcesTab(i) = R
MyR = CVar(MyResourcesTab(i))
i = i + 1
Next R
End If
numberTab = i
If (T.Summary <> "Vrai" And T.Name = "Tache2" And T.Type =
pjFixedDuration) Then
If (DateDiff("d", T.BaselineStart, T.Start) < 0) Then
'rétablir la date de début
T.Start = T.BaselineStart
End If
If (DateDiff("d", T.BaselineStart, T.Start) > 0) Then
'rétablir la date de début
T.Start = T.BaselineStart
End If
T.Duration = T.BaselineDuration
If (DateDiff("d", T.BaselineFinish, T.Finish) < 0) Then
T.Finish = T.BaselineFinish
End If
If (DateDiff("d", T.BaselineFinish, T.Finish) > 0) Then
T.Finish = T.BaselineFinish
End If
End If
i = 0
If (T.Name = "Tache2") Then
For Each R In T.Resources
R.Work = MyResourcesTab(i).Work
R.ActualWork = MyResourcesTab(i).ActualWork
i = i + 1
Next R
End If
End If
Next T
End Sub
#############################################################
Thank you,
Best regards,
Alexandre BARAULT
Context:
Get an object resource from a task => It's ok
Put the object resource in an array => I think ok, but not sure
Convert the object from array as resource
I try to modify the behavior of project for the remaining work
So I decide to modify the planning according with the baseline.
I browse the resource of one task because I should save the work and actual
work.
But I encountered any issue.
When I see with the spy in vba the object R is equal to 1. I click on the
button expand and I can see the details.
So I expected to put the object R in my array and browse R later.
But I see with the spy MyResourcesTab(i) = 1. so I think it's because VBA in
project don't manage really the object.
I try to use CTYPE but is not exist and CVAR doesn't apply here.
So before to use two arrays and add the work in the first and the actual
work in the second, I ask you if you have already
work with object and know how I can solve it.
ReDim MyResourcesTab(T.Resources.Count)
For Each R In T.Resources
MyResourcesTab(i) = R
MyR = CVar(MyResourcesTab(i))
i = i + 1
Next R
######################"CODE##############################""
Sub PlanificationInitiale()
Dim T As Task
Dim R As Resource
Dim i As Integer
i = 0
Dim numberTab As Integer
Dim MyResourcesTab()
For Each T In ActiveProject.Tasks
If Not (T Is Nothing) Then
If (T.Name = "Tache2") Then
ReDim MyResourcesTab(T.Resources.Count)
For Each R In T.Resources
MyResourcesTab(i) = R
MyR = CVar(MyResourcesTab(i))
i = i + 1
Next R
End If
numberTab = i
If (T.Summary <> "Vrai" And T.Name = "Tache2" And T.Type =
pjFixedDuration) Then
If (DateDiff("d", T.BaselineStart, T.Start) < 0) Then
'rétablir la date de début
T.Start = T.BaselineStart
End If
If (DateDiff("d", T.BaselineStart, T.Start) > 0) Then
'rétablir la date de début
T.Start = T.BaselineStart
End If
T.Duration = T.BaselineDuration
If (DateDiff("d", T.BaselineFinish, T.Finish) < 0) Then
T.Finish = T.BaselineFinish
End If
If (DateDiff("d", T.BaselineFinish, T.Finish) > 0) Then
T.Finish = T.BaselineFinish
End If
End If
i = 0
If (T.Name = "Tache2") Then
For Each R In T.Resources
R.Work = MyResourcesTab(i).Work
R.ActualWork = MyResourcesTab(i).ActualWork
i = i + 1
Next R
End If
End If
Next T
End Sub
#############################################################
Thank you,
Best regards,
Alexandre BARAULT