Share via

Microsoft Project Duplicate Task VBA

Anonymous
2013-07-09T20:01:35+00:00

I wish to delete duplicate tasks from a project using a VBA script. I have multiple tasks imported from a maintenance management system, unfortunately some tasks are duplicated. Is it possible to right a script to remove all duplicate tasks but leave the original. I have managed to obtain the results in Excel but cannot replicate in MPP. I would be grateful for any assistance.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2013-07-10T21:19:58+00:00

Hi,

First he easy question. There is only one good bok on Project VBA: "VBA programming for Microsoft Office Project" by Fellow MVP Rod Gill.

A code about duplicates may look like this:

set Col1=activeproject.tasks

set Col2=activeproject.tasks

For each T1 in Col1

if not T1 is nothing then

for each T2 in Col2

if not T2 is nothing then

If T2.ID>T1.ID then

if T2.name=T1.name then

T2.Flag1=true

end if 'names same

end if 'only for higher IDs

end if 'T2 is nothing

next T2

end if 'T1 is nothing

next T1

Greetings,

Was this answer helpful?

0 comments No comments

7 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-07-11T19:29:20+00:00

    Hi Jan,

    Code was ideal. tested a couple of times and then replaced flag option with delete.

    Thanks so much.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-07-10T21:48:37+00:00

    Hi,

    I will give the code a go tomorrow at work and let you know the outcome.

    I will source the book you have recommended, and give it a try.

    Once again thanks for your kind assistance and time.

    Kind Regards

    Ken

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-07-10T18:45:40+00:00

    Hi Jan, thanks for the reply. Execution time will not be an issue. 

    I will be able to identify the original tasks by their MPP ID No. New additions will be added below the original import data, so I will be able to differentiate all Originals from duplicates by a set ID No.(Imports will be done daily). Any assistance in writing a code would be of great help and support in developing my knowledge in MPP VBA objects and properties. (Even modifying the text format would help in identifying duplicates)

    P.S could you recommend any reference books on this subject.

    Once again thanks for your kind response and I look forward to hearing from you soon.

    Ken.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2013-07-10T18:14:33+00:00

    Hi,

    Can be done, sure.

    Two questions come to mind, however:

    • One can detect doubles or triplets but... how to know which one is the original?
    • Does execution time matter? If not the code may be rather easy - providing you know which one is the original!

    Greetings,

    Was this answer helpful?

    0 comments No comments