Forum Discussion

Robert0842's avatar
Robert0842
Copper Contributor
May 10, 2021

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 ?

Thanks and regards

  • 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.
  • 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
    • Robert0842's avatar
      Robert0842
      Copper Contributor
      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
      • Miles_Goodchild's avatar
        Miles_Goodchild
        Brass Contributor
        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 🙂
  • John-project's avatar
    John-project
    Silver Contributor
    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

Resources