Task Recursion

M

MichaelA

Hello All,

Now I am a little stumped. I am needing to recurse upwards through
summary tasks.

I am using the newtask event which has the parameters: pj as project;
id as long

current task is pj.tasks.uniqueid(id)
parent task is pj.tasks.uniqueid(id).outlineparent

dim tsk as task
'I should be able to move upwards by doing this
tsk = pj.tasks.unique(id).outlineparent

so then going up again
tsk = tsk.outlineparent

But I keep getting an error.

here is my actual code that I have finessed to no avail.

taskLevel = pj.Tasks.UniqueID(ID).OutlineLevel
Set tsk = pj.Tasks.UniqueID(ID)
If taskLevel > 2 Then
While taskLevel > 2
tsk = tsk.OutlineParent
taskLevel = tsk.OutlineLevel
Wend
End If

Any thoughts on where I have gone wrong?

Thanks and regards
Michael A.
 

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