已答覆 Baseline Detection

  • Tuesday, June 15, 2010 6:25 PM
     
     
    What is the most reliable way to detect, using VBA, if a baseline has been set?

All Replies

  • Wednesday, June 16, 2010 12:34 AM
    Moderator
     
     Answered

    To dermine the baseline assigned for Earned Value, try this


    Application.ActiveProject.EarnedValueBaseline

    It returns an integer representing the baseline used for EV Calculations.

    0, 1, 2, 3 ...

    Once you know that, then you can check for the existence of a date:

    Application.ActiveProject.BaselineSavedDate

    If the value returned is a date, then you have it.  If the value is not a date, then the baseline has not been set.


    jeaksel at yahoo dot com
    • Edited by Jim AkselMVP, Moderator Wednesday, June 16, 2010 12:36 AM correct grammar, layout to make readable
    • Marked As Answer by RobVV Wednesday, June 16, 2010 1:33 PM
    •  
  • Wednesday, June 16, 2010 1:37 PM
     
     
    Thanks, Jim.  My post is the first for me on this forum (post TechNet).  How do I mark your response as helpful?
  • Wednesday, June 16, 2010 3:31 PM
     
     
    Jim, the EarnedValueBaseline returns or sets the method for calculating EV, rather than indicating the baseline used in the calculation.  The BaselineSavedDate is the one we want.  If a baseline has not been set, it has the value of "NA"; otherwise, it has the date when the baseline was set.
  • Wednesday, June 16, 2010 6:04 PM
    Moderator
     
     
    Just vote for it.
    jeaksel at yahoo dot com
  • Wednesday, June 16, 2010 6:16 PM
    Moderator
     
     

    Actually, it appears the documentation disagrees with the behavior.

    If you try this:
    msgBox(ActiveProject.EarnedValueBaseline) it returns an integer reflecting the baseline currently assigned for use in EV caclulations.

    To change the method an indvidual task uses for EV:

    dim tsk as task

    tsk= assign the task to something

    tsk.EarnedValueMethod = pjPercentComplete or pjPhysicalPercentComplete

    If you want to check a specific baseline for a saved date:

    ActiveProject.BaselineSavedDate(pjBaseline)  or ActiveProject.BaselineSavedDate(pjBaseline2), etc.

    You can change which baseline is used for the purposes of calculations:

     OptionsCalculation EVBaseline:=ii   where ii is an integer representing the baseline you want used.  Sorry, I don't have the integer values handy, but I do know that Baseline4 = 15.


    jeaksel at yahoo dot com