none
baseline question RRS feed

  • Question

  • I need a way to automatically set the baseline when I create a new task. We have a master project plan that we add tasks to all the time. It's not really for managing a project but rather for overall resource planning. So each time we have a new effort we add a task or tasks to indicate who on the team will be assigned to the effort and show them as being busy for that period of time. This works great except now we would like to also track actual time worked on the effort and show the varriance so we can better plan for the future. I figured out that I have to set the baseline field with the original hours scheduled and then the actual work field can be used and the work varience will give me my desired results.

    Is there a way to have some VB code run that would set the baseline work field for any task that has a baseline of 0 hours but has hours in the work field? This would only set the baseline if baseline is 0 and work is > 0.  Also, is there a way to prevent the baseline from being modifed by anyone?


    • Edited by hshayhorn Friday, October 18, 2013 5:44 PM
    Friday, October 18, 2013 5:43 PM

All replies

  • hshayhorn,

    Yes to the macro to set the baseline however are you doing this at master level or at each individual subproject because the code would be a little different.

    As far as preventing the baseline from being edited, the only way to do that is to make the file read only.

    Hope this helps.

    John

    Friday, October 18, 2013 6:06 PM
  • Do you know how that could be coded? I would then add the code where?

    how do you make a field read only and would that affect the code being able to update the field? Would code have to be added to change the field to read/write then update baseline then make the field read only again?

    Friday, October 18, 2013 6:21 PM
  • Hi,

    Let me copy John's final phrase:

    As far as preventing the baseline from being edited, the only way to do that is to make the file read only.

    Now when John says the ONLY way he does mean there isn't another one. He specifies making THE FILE read only. There is no such thing as making a field read only, sorry.

    Greetings,

    Friday, October 18, 2013 8:25 PM
    Moderator
  • hshayhorn,

    Writing the code to set the baseline is very simple and has nothing to do with whether the file is read only or not. I assume you would be the one running the macro anyway. However, as I indicated the exact structure of the code depends on whether you want to set the baseline of each subproject or whether you want to do it at master level. The following macro will set the baseline of all tasks with work > 0 but no baseline yet set. This structure is for an individual subproject file. The code would need to be modified if run on a master file and as currently written does not reset the baseline for parent (i.e. summary) tasks.

    Jan clarified the "read only" aspect of Project files.

    Sub setBaseForNewTasks90()
    Dim t As Task
    For Each t In ActiveProject.Tasks
        t.Flag1 = "no"  'make sure flag is cleared
        If t.Work > 0 And t.BaselineWork = 0 Then t.Flag1 = "yes"
    Next t
    FilterEdit Name:="Need baseline", taskfilter:=True, create:=True, overwriteexisting:=True, _
        FieldName:="flag1", test:="equals", Value:="yes", ShowInMenu:=False, showsummarytasks:=False
    FilterApply Name:="Need baseline"
    SelectAll
    'set baseline for the selected tasks only
    BaselineSave all:=False
    FilterApply Name:="all tasks"
    End Sub

    John



    • Edited by John - Project Sunday, October 20, 2013 1:37 AM roll up clarification
    Saturday, October 19, 2013 1:44 AM