Firing an event when pasting a task – possible?

  • I would like to write some VBA code which fires when a task is pasted. The reason is that users quite often create new tasks by copying existing ones, forgetting that these already contain values, e.g. baselines, notes, etc.
    The code should fire when a task is pasted and prompt the user if they want to remove the "hidden" information from the tasks.
    This means that the code should fire:
    - when a user has copied one or several tasks from the actual or a different schedule, and pastes them into the actual schedule
    It should however not fire when:
    - a new empty line is created
    - a task is just moved (drag and drop or cut and paste)

     
  • M
    Martin Härri 👤 Member for 15 years 1 month

    Nick,

    yes, it is possible to trigger a macro with so-called "task events" or "resource events". They fire e.g. when a task is created, deleted, etc.

    Copying in the way that you propose does not work for my users, as I there are several 100 people using MSP, most of them only occasionally. So I cannot teach them that this tool behaves differently than Excel, which they are all familiar with. I need to find a solution to catch copy/paste via macro.

    Any other ideas? Thanks a lot!

    N
    Niek Zonneveld 👤 Member for 21 years 2 months

    Martin,

    I don't think you can just trigger a macro, other than by using a shortcut key (<ctrl> + <key>) or an mpp file that kicks off a macro when it opens.

    Instead of going down the macro-route it's probably better to avoid the problem.

    A way to circumvent copying 'hidden' information is to copy and paste only the cells/info you need, instead of the entire line. This works quite well except for precedence relations. If I want to reuse information from other schedules, I normally only copy the name and duration fields, just to make sure I don't introduce any other rubbish.

    H.T.H.

    Forum Sponsor

    Top Posters

    Julian Pegg
    1 posts
    Peter Nagy
    2 posts
    Raymund de Laza
    17 posts
    Syed_Asad
    0 posts
    Tony Greyvenstein
    0 posts
    Ahmed Al-Jubouri
    13 posts
    Umar Alvi
    3 posts
    Sibusiso Mahlalela
    0 posts
    Michael Samanyayi
    3 posts
    Simon Gumede
    0 posts