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.
7 thoughts on “Simple Macro for Listing Driving Predecessor(s) in MS Project”
Thanks a lot for the predecessors macro. – But:
– when a task has more than one pred. it’s just listing the first
e.g. 1 -> 2;4 -> 3 Listed is only 2 and 3.
Tasks without a predecessor aren’t listed.
E.g. Sequence is: 1 -> 2 -> 3 Listed are only 2 and 3. #1 has no pred. but is important for the list. How to display it?
I’m afraid you may be misunderstanding the purpose of this macro. Please read the article. In short, the custom text field for each task will list only the driving-flagged immediate predecessor(s) of that task. Your examples imply a different expectation.
Thank-you so much for providing this and the more sophisticated Task Path Filter macro.
I am trying to present Driving Information to a non-scheduling, inexperienced PM group in a WBS format (using the WBS view in WBS Schedule Pro). Showing networks and Gantt views, I think would make their collective heads hurt. I am using focused views of only their portion of the WBS but the Driving Predecessor ID may be in alternate leg and not shown in the focused display. A pure numerical ID is not useful if they can’t see what it means.
Would you please re-write this macro to write out both the Driving ID and Driving Task name? I know that Text fields are capped at 255 characters so Task Names may need to be truncated if they are excessive.
Thanks in advance
You could edit the macro yourself by changing
td.From.ID & ” ” & td.From.Name
each place it occurs.
Thank you Tom.
My VBA skills are sorely lacking even though I guessed it would be something simple.
Thanks to further help from Tom and some more careful typing by me, I was able to get the Macro doing what I wanted.
Thanks again, Tom
RK, glad you got it working.