Predecessors in MS Project

Have you ever been annoyed, that MS Project does not list you dates of predecessors in its task form? How do you quickly determine the driving predecessor? If you have many predecessors for a tasks, finding the driving task (without switching views…) can become pretty cumbersome.
Microsoft Project - foo

The solution: add a button to MS Project and run a macro that lists all unfinished predecessors along with its line number and finish date.

Microsoft Project - MSgBOx

No idea, how to use this code? Check out, how to add VBA code to your computer.

Public Sub swaPre()
    Dim t As Task
    Dim msg As String
    msg = ActiveSelection.Tasks.Item(1).Name & vbNewLine & vbNewLine
    For Each t In ActiveSelection.Tasks.Item(1).PredecessorTasks
        ' remove all closed predecessors
        If t.PercentComplete <> 100 Then msg = msg & t.ID & vbTab & Left(t.Name, 30) & vbTab & Format(t.Finish, "dd.mm.yyyy") & vbNewLine
    Next t
    MsgBox msg, vbInformation, "Predecessors, percent complete <> 100 and finish dates"
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *