VBA task insert into an existing task list? 
Author Message
 VBA task insert into an existing task list?

I'm trying to insert a new task into ( in between ) an existing list of
tasks.

This code:
activeproject.tasks.add("my new task")

Will always insert the task at the end of the list.

There is an additional parameter, [before], in the add method but I can't
find the documentation for the valid use of this parameter.

Is it possible to insert a task with VBA into the middle of an existing task
list?

Do I need an "absolute" row reference for the [before] parameter?  If so how
do I get the current row in the task list?

Thanks,
Bruss Bowman



Mon, 04 Oct 2004 08:16:06 GMT  
 VBA task insert into an existing task list?
Well, if by 'current row' you mean the row that is actively selected then you
could do something like this:

ActiveProject.Tasks.Add Name:="The New Task", _
Before:=ActiveSelection.Tasks(1).ID

This will insert the new task on the row above the selected task. If the active
selection contains more than one task it will insert it before the first task
in the selection.
--
Brian K
MS Project MVP



Mon, 04 Oct 2004 15:07:04 GMT  
 VBA task insert into an existing task list?
Brian,

Quote:
> ActiveProject.Tasks.Add Name:="The New Task", _
> Before:=ActiveSelection.Tasks(1).ID

That's exactly what I needed.

I'm still trying to find my way around Project's object model, thanks for
the help.

Bruss Bowman



Mon, 04 Oct 2004 23:47:47 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Adding tasks to a named task list

2. Keep updated copy of this task on my task list

3. Hiding Task ID in Task List

4. need help on ending a task in windows task list

5. Program ID does not appear in Task Bar and Task List

6. Removing a task from the WinNT task list...

7. inserting name of higher level task trough vba

8. Looking for a Task List manager add-in for the VBA IDE

9. Looking for a Task List manager add-in for the VBA IDE

10. To-do list (task list) and reminder

11. How do I get the list of programs in the task list (vb5Pro)

12. How to Create Task Item in Someone Else's Task Folder

 

 
Powered by phpBB® Forum Software