none
MS Project 2013 \ How trig a macro from button "compute projet" RRS feed

  • Question

  • Hello,

    i am looking for a way to run a macro (in VB) when the button "compute projet" is press.

    Is someone know if it is possible to do this with VB macro in MS projet 2013 ?

    think


    Friday, August 7, 2015 6:09 PM

Answers

  • Tom you're a scholar, gentleman and a great judge of whiskey for recommending my book!

    There is a Calculate event:

    Private Sub Project_Calculate(ByVal pj As Project)

    End Sub

    Copy this to the ThisBook file. For easier updating I recommend you call a sub from this event and put the Sub in a Module.

    So your code is:

    'In the ThisProject file
    Private Sub Project_Calculate(ByVal pj As Project)
        CalculateEventCode pj
    End Sub
    
    
    'In a separate Module:
    Sub CalculateEventCode(pj As Project)
        'My code here
    End Sub
    
    Us the pj object to refer to your project. This makes sure the correct project is changed if the user swaps to a different project before the macro finishes.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Monday, August 10, 2015 8:42 PM
    Moderator

All replies

  • There should be an application calculation event that you can start from.  Rod Gill has a chapter on this in his book.
    Friday, August 7, 2015 9:33 PM
  • Tom you're a scholar, gentleman and a great judge of whiskey for recommending my book!

    There is a Calculate event:

    Private Sub Project_Calculate(ByVal pj As Project)

    End Sub

    Copy this to the ThisBook file. For easier updating I recommend you call a sub from this event and put the Sub in a Module.

    So your code is:

    'In the ThisProject file
    Private Sub Project_Calculate(ByVal pj As Project)
        CalculateEventCode pj
    End Sub
    
    
    'In a separate Module:
    Sub CalculateEventCode(pj As Project)
        'My code here
    End Sub
    
    Us the pj object to refer to your project. This makes sure the correct project is changed if the user swaps to a different project before the macro finishes.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Monday, August 10, 2015 8:42 PM
    Moderator