Task Predecessor Drivers

Home Forums Microsoft Project Discussion Forum Task Predecessor Drivers

Viewing 2 reply threads
  • Author
    • #350286

      Al Fernandez asked:
      When a task has more then one predecessor, what would be the name for the predecessor that occurs last, that is actually driving the task? Can that task be identified by ID in a column? I would like to have a column that only shows the one predecessor, namely the one that if changed by one day will affect the task by one day. As the schedule progresses and actual start dates are added, a different one of the predecessor could possibly take this role. When I use the Task Inspector, it gives me the last predecessor in the column, can this behavior be modified to show the “most critical” predecessor?

      Firstly, some background:

        In 2010 the Task Inspector highlights driving predecessor(s) and not all predecessors
        These are the non-complete predecessors with the closest finish date to their sucessor
        Unless two or more predecessors have the same date AND time, only the very latest predecessor is shown in the Task Inspector

      Within VBA, there is a Class called StartDriver that has a Collection Class of PredecessorDrivers
      Using this, I developed the code below in MS Project 2010

      Comments welcome

      `Option Explicit
      ‘ © Andy Forrester June 2015

      Sub Drivers()
      Dim prj As Project
      Dim tsk As Task
      Dim Driver As Object
      Dim Drivertext As String

      Set prj = ActiveProject

      Application.Calculation = pjManual ‘Stop Calculating
      Application.ScreenUpdating = False ‘Stop Refeshing the Screen

      For Each tsk In prj.Tasks
      Application.StatusBar = “Checking ID: ” & tsk.ID

      If Not tsk Is Nothing Then ‘skip blank tasks
      If Not tsk.Summary Then ‘ skip Summary Tasks
      If tsk.PercentComplete <> 100 Then ‘ skip complete tasks
      If tsk.StartDriver.PredecessorDrivers.Count > 0 Then ‘There is at least one Driver
      tsk.Text29 = “” ‘Clear text29 from previous runs
      Drivertext = “Driver ID(s) :”
      For Each Driver In tsk.StartDriver.PredecessorDrivers
      Drivertext = Drivertext & ” ” & Driver.From.ID
      Next Driver
      tsk.Text29 = Drivertext
      End If

      End If
      End If
      End If
      Next tsk

      Application.StatusBar = False
      Application.Calculation = pjAutomatic ‘Start Calculating
      Application.ScreenUpdating = True ‘Start Refeshing the Screen
      MsgBox “Driver Checking Complete”
      End Sub

    • #350287
    • #350298

      For info, the StartDriver Class was introduced in MS Project 2007, so this code should also work in 2007 versions, but not any prior ones

Viewing 2 reply threads
  • You must be logged in to reply to this topic.