Forum Discussion
Jamesp435
Feb 02, 2022Brass Contributor
MS Project VBA running a macro with a field change...
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
Hello Jamesp435 ,
I've not tried it but this might help https://docs.microsoft.com/en-us/office/vba/api/project.project.change
Paul
Hello Jamesp435 ,
I've not tried it but this might help https://docs.microsoft.com/en-us/office/vba/api/project.project.change
Paul
- Jamesp435Brass ContributorThanks for that Paul. Very useful. James
- John-projectSilver ContributorJamesp435,
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- Jamesp435Brass ContributorThat's a good point John. That's what I did when doing a lot of Visio VBA a while back... Cheers
- John-projectSilver ContributorJames,
You're welcome and thanks for the feedback.
John