Forum Discussion
Robert0842
May 10, 2021Copper Contributor
Task ID and Predecessor with VBA
Hi, In a mpp file I have the tasks ID and predecessors of many tasks. I need to transmit them into another mpp file using VBA. The tasks are not listed in the same order. How can I do that ? Thank...
Miles_Goodchild
May 10, 2021Brass Contributor
I am not sure why you would want to do this however
1) If the tasks have something in common (name, Unique ID etc) which means that you know that Task 1 in the original file is is actually task 10 in the new file then you can use this information as a key in Excel and use a VLOOKUP; copy the data from the Original File into one set of columns and then copy the information from the new file into another set of columns and use VLOOKUP to transfer the data and then copy and paste back into MSP
2) Copying the tasks (i.e. the whole line) from one plan to another will take across all data including dependencies but I suspect this isn't what you're trying to do.
Maybe some more information about what you're trying to do will help people to come up with ideas?
HTH
Miles
1) If the tasks have something in common (name, Unique ID etc) which means that you know that Task 1 in the original file is is actually task 10 in the new file then you can use this information as a key in Excel and use a VLOOKUP; copy the data from the Original File into one set of columns and then copy the information from the new file into another set of columns and use VLOOKUP to transfer the data and then copy and paste back into MSP
2) Copying the tasks (i.e. the whole line) from one plan to another will take across all data including dependencies but I suspect this isn't what you're trying to do.
Maybe some more information about what you're trying to do will help people to come up with ideas?
HTH
Miles
- Robert0842May 11, 2021Copper ContributorHi,
Thanks for trying to help me.
I'll try to explain more accurately.
The user created a schedule: 1600 tasks and a WBS, and then he activated a grouping.
Now he wants the structure of the grouping as a new WBS.
The Copy and Paste works fine for most of the fields, but it doesn't work for the Predecessors column. For example, in the original file the predecessor of Task 3 was Task 2, but in the new file Task ID 2 is its own summary.
Any idea?
Thanks again- Miles_GoodchildMay 12, 2021Brass ContributorThe real issue may arise if your user has linked to or from Summary Lines - I would remove these before attempting to run the group and re-order as per Dale's comment. There will be some manual work to build the new WBS and structure however this will not be a massive task and will be a lot less than messing around with VBA I suspect 🙂
- John-projectMay 11, 2021Silver ContributorRobert0842,
You're expanded "explanation" is still a bit iffy. Your original post mentioned two separate(?) files but it sounds like you have a single file that you want to re-structure based on grouping.
You do understand that grouping does not create new summary lines, right? Grouping simply creates a custom "sort" with "summary lines" for display only. Here's an idea that may make this a whole lot easier.
Instead of grouping, use the sort feature to re-organize the file as desired. Select the option to "permanently renumber tasks". The task dependencies will automatically re-align based on the new task IDs. The WBS can be manually adjusted to the new outline.
If your file structure is more complex (i.e. the above scheme doesn't work for you), then you'll have to provide us with more details (e.g. some screen shots of a before and after sampling) in order for any of us to give a better answer. That answer may or may not involve the use of VBA.
John