none
VBA - Calculate event / MS Project 2013 RRS feed

  • Question

  • Hello,

    i am looking for a way to improve what i have already done. I made a fonction which copy PercentWorkComplete to PhysicalPercentComplete like this:

    Private Sub Project_Calculate(ByVal pj As Project)
        PercentWorkCompleteToPhysicalPercentComplete
    End Sub
    
    
    Sub PercentWorkCompleteToPhysicalPercentComplete()
    Dim Tsk As Task
        For Each Tsk In ActiveProject.Tasks
            If Not Tsk Is Nothing Then
                If Tsk.Summary = False Then
                    If Tsk.Active = True Then
                        Tsk.PhysicalPercentComplete = Tsk.PercentWorkComplete
                    End If
                End If
            End If
        Next Tsk
        '- Affichage d'un compteur dans la barre de statut
        Static count As Integer
        count = count + 1
        Application.StatusBar = "Percent WorkComplete To Physical Percent Complete " + CStr(count)
    End Sub
    

    The drawback is that the user need to click on the "Compute Project" button to make this function running. I am looking a way to execute this function every time project computes the project itself (the option "Compute the project each time a modification is made" is active).

    Is there a way to doing this ?

    Thank

    Sébastien

    Saturday, September 10, 2016 1:52 AM

Answers

  • Not one that I'm aware of. However when do you need to use this information? If only when reporting, then maybe running the code before each save using the save event? So as long as the project is saved before reporting....

    There is the task change event, but running this code for larger projects on change would cause a noticeable delay.


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

    Saturday, September 10, 2016 9:31 PM
    Moderator

All replies

  • Not one that I'm aware of. However when do you need to use this information? If only when reporting, then maybe running the code before each save using the save event? So as long as the project is saved before reporting....

    There is the task change event, but running this code for larger projects on change would cause a noticeable delay.


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

    Saturday, September 10, 2016 9:31 PM
    Moderator
  • i made a mistake. i just remark that when i change the task's actual work, and consequently the %Work complete change, the function is called and the %physical complete is updated. That is exactly what i wanted. 

    Sorry for the disturbance. Thanks
    Sébastien
    The reason i do this is because i want the earned value management to be based on the %Work complete.

     
    Sunday, September 11, 2016 12:43 AM