PDA

View Full Version : Insert SubProject after Task x? (Linking ConsolidateProjects to Task)



surumadurum
03-31-2016, 07:51 AM
Hi,

I have to solve the task of dynamically inserting Sub-Projects into a Master-Project at a specific position - which is under a certain "heading" and after all the already inserted SubProjects.

Heading A
Heading Aa
- Project A1
- Project A2
Heading B
- Project B1

My problem is that ConsolidateProjects inserts the project at the current cursor position.
Now I solved it like that:

- collapse / expand all Tasks so that Headings and Subheadings are visible but all Subtasks of Sub-Projects are hidden
- iterate through rows with SelectRow, get task-name with ActiveSelection.Tasks(1).Name
- if it's the right heading, get number of already inserted subprojects with Tasks(from_last_step).OutlineChildren.Count
- Call ConsolidateProjects
- Indent the new inserted project to the correct level

This solution has shown to be very error-prone. The initial indent of the new subproject seems quite random and often the subprojects and up at the wrong position.

Isn't there any solution like "Insert subproject after Task(x), no matter in which row it is displayed at the moment"?

Hope somebody has help!