Task ID and Predecessor with VBA

%3CLINGO-SUB%20id%3D%22lingo-sub-2341251%22%20slang%3D%22en-US%22%3ETask%20ID%20and%20Predecessor%20with%20VBA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2341251%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EIn%20a%20mpp%20file%20I%20have%20the%20tasks%20ID%20and%20predecessors%20of%20many%20tasks.%20I%20need%20to%20transmit%20them%20into%20another%20mpp%20file%20using%20VBA.%20The%20tasks%20are%20not%20listed%20in%20the%20same%20order.%3C%2FP%3E%3CP%3EHow%20can%20I%20do%20that%20%3F%3C%2FP%3E%3CP%3EThanks%20and%20regards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2341736%22%20slang%3D%22en-US%22%3ERe%3A%20Task%20ID%20and%20Predecessor%20with%20VBA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2341736%22%20slang%3D%22en-US%22%3ERobert0842%2C%3CBR%20%2F%3EWhoa%2C%20wait%20a%20minute%2C%20what%20you're%20asking%20doesn't%20make%20a%20lot%20of%20sense.%20What%20exactly%20are%20you%20trying%20to%20do%3F%20And%20why%20do%20you%20think%20you%20want%20to%20do%20it%3F%3CBR%20%2F%3E%3CBR%20%2F%3EIf%20the%20tasks%20in%20the%20other%20file%20are%20in%20a%20different%20order%2C%20all%20the%20IDs%20and%20predecessor%20(IDs)%20will%20be%20completely%20different%2C%20hence%20your%20request%20doesn't%20make%20much%20sense.%3CBR%20%2F%3E%3CBR%20%2F%3EJohn%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2341759%22%20slang%3D%22en-US%22%3ERe%3A%20Task%20ID%20and%20Predecessor%20with%20VBA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2341759%22%20slang%3D%22en-US%22%3EI%20am%20not%20sure%20why%20you%20would%20want%20to%20do%20this%20however%3CBR%20%2F%3E1)%20If%20the%20tasks%20have%20something%20in%20common%20(name%2C%20Unique%20ID%20etc)%20which%20means%20that%20you%20know%20that%20Task%201%20in%20the%20original%20file%20is%20is%20actually%20task%2010%20in%20the%20new%20file%20then%20you%20can%20use%20this%20information%20as%20a%20key%20in%20Excel%20and%20use%20a%20VLOOKUP%3B%20copy%20the%20data%20from%20the%20Original%20File%20into%20one%20set%20of%20columns%20and%20then%20copy%20the%20information%20from%20the%20new%20file%20into%20another%20set%20of%20columns%20and%20use%20VLOOKUP%20to%20transfer%20the%20data%20and%20then%20copy%20and%20paste%20back%20into%20MSP%3CBR%20%2F%3E2)%20Copying%20the%20tasks%20(i.e.%20the%20whole%20line)%20from%20one%20plan%20to%20another%20will%20take%20across%20all%20data%20including%20dependencies%20but%20I%20suspect%20this%20isn't%20what%20you're%20trying%20to%20do.%3CBR%20%2F%3EMaybe%20some%20more%20information%20about%20what%20you're%20trying%20to%20do%20will%20help%20people%20to%20come%20up%20with%20ideas%3F%3CBR%20%2F%3EHTH%3CBR%20%2F%3EMiles%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2342527%22%20slang%3D%22en-US%22%3ERe%3A%20Task%20ID%20and%20Predecessor%20with%20VBA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2342527%22%20slang%3D%22en-US%22%3ERobert%20--%3CBR%20%2F%3E%3CBR%20%2F%3EWhy%20don't%20you%20just%20use%20copy%20and%20paste%3F%20Using%20VBA%20seems%20like%20overkill%2C%20unless%20you%20have%20some%20very%20special%20need%20for%20doing%20so.%20Maybe%20you%20need%20to%20explain%20what%20you%20are%20trying%20to%20do%20and%20then%20we%20could%20help%20you.%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2343965%22%20slang%3D%22en-US%22%3ERe%3A%20Task%20ID%20and%20Predecessor%20with%20VBA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2343965%22%20slang%3D%22en-US%22%3EHi%2C%3CBR%20%2F%3EThanks%20for%20trying%20to%20help%20me.%3CBR%20%2F%3EI'll%20try%20to%20explain%20more%20accurately.%3CBR%20%2F%3EThe%20user%20created%20a%20schedule%3A%201600%20tasks%20and%20a%20WBS%2C%20and%20then%20he%20activated%20a%20grouping.%3CBR%20%2F%3ENow%20he%20wants%20the%20structure%20of%20the%20grouping%20as%20a%20new%20WBS.%3CBR%20%2F%3EThe%20Copy%20and%20Paste%20works%20fine%20for%20most%20of%20the%20fields%2C%20but%20it%20doesn't%20work%20for%20the%20Predecessors%20column.%20For%20example%2C%20in%20the%20original%20file%20the%20predecessor%20of%20Task%203%20was%20Task%202%2C%20but%20in%20the%20new%20file%20Task%20ID%202%20is%20its%20own%20summary.%3CBR%20%2F%3EAny%20idea%3F%3CBR%20%2F%3EThanks%20again%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E
New Contributor

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 ?

Thanks and regards

6 Replies
Robert0842,
Whoa, wait a minute, what you're asking doesn't make a lot of sense. What exactly are you trying to do? And why do you think you want to do it?

If the tasks in the other file are in a different order, all the IDs and predecessor (IDs) will be completely different, hence your request doesn't make much sense.

John
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
Robert --

Why don't you just use copy and paste? Using VBA seems like overkill, unless you have some very special need for doing so. Maybe you need to explain what you are trying to do and then we could help you.
Hi,
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
Robert0842,
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
The 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 :)