OutlineGrandParent.duration

R

RixMcx

Option Explicit
Sub CopyPhaseDurationToDuration1()
Dim Tsk As Task
Dim Duration1 As Integer
For Each Tsk In ActiveProject.Tasks
If Not Tsk Is Nothing Then 'Test for blank rows
If Tsk.Summary Then
Tsk.Duration1 = Tsk.Duration
Else
Tsk.Duration1 = Tsk.OutlineParent.Duration
End If
End If
Next Tsk
End Sub

I am getting the parent duration and need the GrandParent duration.
I would like to control the code above to return the value of Outline Level
3. The code works the way it is(thanks Rod), but it gives each sub task its
summary task duration. I would like to capture Phase duration. I am not
sure if I would use outline or indent keyword to capture just the Phase
duration.
 
J

Jan De Messemaeker

Hi,

Supposing your phases are on Outline level 1, try the following:

Sub Phaseduration()
dim Job as task
Dim Older as task

for each job in activeproject.tasks
if not job is nothing then
set older=job
do while older.outlinelevel>1
set older=older.outlineparent
loop
job.duration1=older.duration
end if
next job
end sub

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 
R

RixMcx

Superb! thank you

Jan De Messemaeker said:
Hi,

Supposing your phases are on Outline level 1, try the following:

Sub Phaseduration()
dim Job as task
Dim Older as task

for each job in activeproject.tasks
if not job is nothing then
set older=job
do while older.outlinelevel>1
set older=older.outlineparent
loop
job.duration1=older.duration
end if
next job
end sub

--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top