MSP2010 Profesional
I have to alter my schedule to finish room-by-room instead of floor-by-floor. So, I gathered a template of tasks for each room (Paint walls, Hang Ceiling, Install Doors, etc.) and started inserting them into each floor (8 floors, 30+ rooms per floor). Since the sequences were all identical, I thought I'd copy/paste. But, since I like redundancy (and often show tasks without their hierarchy...) I like the room number to be featured in every task ("Hang Ceiling -- 2.C.34.01"), and, I have custom fields for Building, Level, and Room Nbr.
So, I decide to create a simple vba routine. To make it simple, I want to select a sequence and have it sort of cut/paste that sequence (a hierarchy...) just above the selected sequence (at the same indent level) then change the description, add in the new room number (inputbox...) in both places on each task, then alter each task to have the correct Building and Levels, then set them to be a true sequence (pred/succ.)
First thing I learn is that the activeselection.tasks collection seems to feed the tasks in order...can I count on that?
So, I start trying the "activeproject.tasks.add" method. VERY POORLY DOCUMENTED. It has two arguments..."Name", a string, and "Before", no type defined.
First, I tried omitting it...added the task at the end of the project...OK, but not optimal
Second, I tried using "Activeselection.tasks(1).ID"...got a syntax error
Third, I tried using <12> (some random integer I made up...) ...got a syntax error.
So, what is the type of the "Before" argument?
Once added, how do I find the ID or UniqueID of the new task, since I have no reference to it?
How do it set it to fall into the same outlinelevel of the selected series, with the appropriate parent? (Parent is a read-only property, right?)
Is my whole strategy wrong?
Jim