none
Automatically change flag when date updated RRS feed

  • Question

  • Hi,

    I'm trying to work out how to automatically change a flag field to yes if the date of a task changes. I don't know if this is possible but if anyone has any ideas on how to do this some help would be appreciated.

    Wednesday, February 3, 2016 9:03 AM

Answers

  • Make a module in your project and insert this:

    Sub UpdateDateChangeFlag()
    ' assuming you saved the baseline to Finish1 and want the flag field to be Flag1
        Dim t As Task
        For Each t In ActiveProject.Tasks
            If Not t Is Nothing Then ' no empty rows!
                If Not (t.GroupBySummary Or t.Summary) Then ' no summary tasks!
                    t.Flag1 = t.Finish <> t.Finish1
                End If
            End If
        Next
    End Sub

    Attach it to a key and run after you update. You could get fancier and use a text or number field instead of the flag to indicate whether the date moved forward or back.

    • Marked as answer by steve183 Thursday, February 4, 2016 3:30 PM
    Thursday, February 4, 2016 2:42 PM

All replies

  • Hi Steve,

    Yes it should be possible with some VBA, to set a flag to yes each time a date is changed but...

    I think your need has to be dug a little bit more. For example, when the date is changed and the flag set to YES, how does the flag switch back to NO? What is the need/process behind? You could for example use a baseline which could be overwritten each time you want to track changes. Then it is possible to automatically set a flag to yes if the dates are different from the baseline dates.


    Hope this helps,


    Guillaume Rouyre, MBA, MVP, MCC |

    Wednesday, February 3, 2016 9:17 AM
    Moderator
  • Hi Guillaume,

    There are really two options:

    1. The first would be more desirable but I imagine a lot more complicated. We are currently using Project 2 outlook to export entries to our outlook calendar. If possible when the items have been exported if the flag could be reset to NO then that would be ideal but I don't know how easy that would be.

    2. The other option is simply a manual reset.

    A question about the baseline. Could this be written in so when the necessary tasks have been exported the updated dates are set as the new baseline?

    Also forgot to say I am using Project standard 2013


    Wednesday, February 3, 2016 9:24 AM
  • I don"t know this Project 2 Outlook addon but it would probably be a custom development (VBA). Or maybe not if this addon populates some custom fields in Project Pro, so you can retrieve this information weither or not the task has been exported and the export date.

    Maybe Ben Howard who is familiar with this addon will jump in and bring some more information.


    Hope this helps,


    Guillaume Rouyre, MBA, MVP, MCC |

    Wednesday, February 3, 2016 10:06 AM
    Moderator
  • One approach is to reset a baseline (not the main baseline) every week before updating. That way any variance means a date change.

    It also provides a very powerful report on progress since last week which is especially useful for time critical projects.


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


    Wednesday, February 3, 2016 7:18 PM
    Moderator
  • Thanks Rod that's what I needed

    Now I've set baseline can anyone give me the VBA to compare baseline and actual dates which will effect a change to the flag?

    I am trying to learn VBA myself but it is going quite slowly and I don't think my skills are quite up to the task yet!

    Thursday, February 4, 2016 9:20 AM
  • Make a module in your project and insert this:

    Sub UpdateDateChangeFlag()
    ' assuming you saved the baseline to Finish1 and want the flag field to be Flag1
        Dim t As Task
        For Each t In ActiveProject.Tasks
            If Not t Is Nothing Then ' no empty rows!
                If Not (t.GroupBySummary Or t.Summary) Then ' no summary tasks!
                    t.Flag1 = t.Finish <> t.Finish1
                End If
            End If
        Next
    End Sub

    Attach it to a key and run after you update. You could get fancier and use a text or number field instead of the flag to indicate whether the date moved forward or back.

    • Marked as answer by steve183 Thursday, February 4, 2016 3:30 PM
    Thursday, February 4, 2016 2:42 PM
  • Thanks Bill 

    Added your code into the spreadsheet and works exactly how I wanted.

    Thursday, February 4, 2016 3:33 PM