Add task with WBS code

S

Sam

Hi,

I have to add tasks in an existing project, using vba. I have the parent
WBS outline code for the task.
For example I have a new task call "task1". My WBS structure is:

1. taskx
1.1 aa
1.2 bb
2. tasky

task1's parent WBS code is "1". I want my code to add my new task at 1.3.
How could I do this? I tried:
atask.OutlineChildren.add(task1)

but that doesn't work, it adds my task at the end.

Any ideas?
 
J

Jan De Messemaeker

Hi,

Find the id of tasky then (say YY)
activeproject.tasks.add before:=YY
HTH
 
S

Sam

I thought about this but I'm having trouble determining what is the element
following my parent.

For example if I add a subtask to 1.2, the next element could be "2", just
like in my example, but it also could be 1.3, or nothing (if it's the last
element).

I could probably check if 1.3 exists, then check if 2 exists, etc. But if
anyone has a better (simpler) idea, that'd be appreciated. Thanks!
 
J

Jan De Messemaeker

Hi,

And I forgot... stop thinkiing that WBS is something important thatr can
make you access tasks. Think in terms of ID, name, or UniqueID
And if you think this is too complicated, bad luck.

HTH
 

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