Website Upgrade Incoming - we're working on a new look (and speed!) standby while we deliver the project

Tips on using this forum..

(1) Explain your problem, don't simply post "This isn't working". What were you doing when you faced the problem? What have you tried to resolve - did you look for a solution using "Search" ? Has it happened just once or several times?

(2) It's also good to get feedback when a solution is found, return to the original post to explain how it was resolved so that more people can also use the results.

Firing an event when pasting a task – possible?

2 replies [Last post]
Martin Härri
User offline. Last seen 6 years 4 weeks ago. Offline
Joined: 2 May 2011
Posts: 7
Groups: None

  • 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)

     
  • Replies

    Martin Härri
    User offline. Last seen 6 years 4 weeks ago. Offline
    Joined: 2 May 2011
    Posts: 7
    Groups: None

    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!

    Niek Zonneveld
    User offline. Last seen 2 years 33 weeks ago. Offline
    Joined: 17 Mar 2005
    Posts: 188
    Groups: None

    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.