From: RixMcx on
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.
From: Jan De Messemaeker on
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
"RixMcx" <RixMcx(a)discussions.microsoft.com> wrote in message
news:3D7EC8AB-8041-4FA8-9663-9ADA7B7A6AE0(a)microsoft.com...
> 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.


From: RixMcx on
Superb! thank you

"Jan De Messemaeker" wrote:

> 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
> "RixMcx" <RixMcx(a)discussions.microsoft.com> wrote in message
> news:3D7EC8AB-8041-4FA8-9663-9ADA7B7A6AE0(a)microsoft.com...
> > 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.
>
>
> .
>