SOLVED

MS Project VBA running a macro with a field change...

%3CLINGO-SUB%20id%3D%22lingo-sub-3103001%22%20slang%3D%22en-US%22%3EMS%20Project%20VBA%20running%20a%20macro%20with%20a%20field%20change...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3103001%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20team%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20the%20off%20chance%2C%20is%20it%20possible%20when%20you%20change%20a%20field%20(say%20duration)%20it%20will%20automatically%20run%20a%20macro%3F%3C%2FP%3E%3CP%3EMany%20thanks%3C%2FP%3E%3CP%3EJames%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3104213%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Project%20VBA%20running%20a%20macro%20with%20a%20field%20change...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3104213%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1124980%22%20target%3D%22_blank%22%3E%40Jamesp435%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EI've%20not%20tried%20it%20but%20this%20might%20help%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice%2Fvba%2Fapi%2Fproject.project.change%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice%2Fvba%2Fapi%2Fproject.project.change%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPaul%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3105584%22%20slang%3D%22en-US%22%3ERe%3A%20MS%20Project%20VBA%20running%20a%20macro%20with%20a%20field%20change...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3105584%22%20slang%3D%22en-US%22%3EJamesp435%2C%3CBR%20%2F%3EPaul%20provided%20an%20excellent%20reference%2C%20let%20me%20add%20a%20word%20of%20caution.%20The%20Change%20Event%20has%20been%20available%20since%20the%20early%20days%20of%20Project%20VBA%20but%20it%20must%20be%20used%20with%20care.%20Since%20the%20event%20is%20fired%20for%20every%20change%2C%20(with%20the%20exceptions%20noted%20in%20the%20article%20Paul%20referenced)%2C%20the%20macro%20can%20slow%20things%20down%20considerably.%20If%20you%20want%20to%20limit%20the%20%22slowdown%22%20overhead%20I%20suggest%20you%20include%20a%20test%20at%20the%20beginning%20of%20the%20macro%20code%20that%20%22bails%20out%22%20if%20the%20change%20is%20not%20related%20to%20the%20field%20of%20interest.%3CBR%20%2F%3EJohn%3C%2FLINGO-BODY%3E
Contributor

Hi team 

On the off chance, is it possible when you change a field (say duration) it will automatically run a macro?

Many thanks

James  

5 Replies
best response confirmed by Jamesp435 (Contributor)
Jamesp435,
Paul provided an excellent reference, let me add a word of caution. The Change Event has been available since the early days of Project VBA but it must be used with care. Since the event is fired for every change, (with the exceptions noted in the article Paul referenced), the macro can slow things down considerably. If you want to limit the "slowdown" overhead I suggest you include a test at the beginning of the macro code that "bails out" if the change is not related to the field of interest.
John
Thanks for that Paul. Very useful. James
That's a good point John. That's what I did when doing a lot of Visio VBA a while back... Cheers
James,
You're welcome and thanks for the feedback.
John