The Drivers macro reads and copies the ID of each task’s driving predecessors into a custom text field for the task.
One of the missing features for anyone coming to MSP from Primavera’s planning tools is the little mark designating the driving predecessor(s) in the predecessors list for each activity.
MS Project 2010+ kind of addresses this with a feature called “Task Inspector” that opens a pane and displays some scheduling factors affecting the selected task. One of the factors displayed is the “Predecessor Tasks:” table, which lists the predecessor(s) (if any) that limit the early start date of the selected task. The driving predecessor is inserted as a link, so it is possible to jump backwards through the driving logic of the schedule.
Since I use BPC Logic Filter, I haven’t had much use for Task Inspector. Still, it is occasionally useful to see a long list of predecessors and know immediately which ones are driving the selected task. Here is a little macro to copy the IDs of the driving predecessors into the “Text2” field of each task.
Sub Drivers() Dim t As Task Dim td As TaskDependency Dim PredDr As String Dim i As Integer For Each t In ActiveProject.Tasks If Not t Is Nothing Then PredDr = "" i = 0 For Each td In t.StartDriver.PredecessorDrivers i = i + 1 If i = 1 Then PredDr = PredDr & td.From.ID Else PredDr = PredDr & "," & td.From.ID End If Next td t.Text2 = PredDr End If Next t End Sub
The user can then insert the “Text2” column in any task view. The image at the top of the post is a little schedule with the column inserted as shown and named “Driving Pred”.
The “Drivers” determination is done by MSP’s scheduling engine, and I have found it to be unreliable for driving predecessors that are not Finish-to-Start links. (Problems with Driving Logic in Task Inspector and Task Paths – Microsoft Project 2010-2016) Nevertheless, it’s better than nothing. Obviously, the macro needs to be re-run whenever the logic or task numbering changes….
If you are interested in a real logic trace of the driving path for the activity, then you’ll need a much more sophisticated macro (like this one) or a full-fledged Add-In like BPC Logic Filter – shown in this video. As a side feature, BPC Logic Filter includes a task Logic Inspector that displays driving and non-driving relationships for any task. Visit the BPC Logic Filter page to download a fully-functioning Trial version.