Loading...
Quick Links

Reply To: Gantt – sort by path

Home Forums Discussion Gantt – sort by path Reply To: Gantt – sort by path

#409671
Sai PrasadSai Prasad
Participant
  • Community Leader
  • Forum Pro

You can use the new Task Path feature along with VBA to display the successor path order
1. You need to paste the below code in VBA editor. Click Format tab, Macros > Visual Basic. Double click “This Project” and paste the below code
Option Explicit

Sub DisplayPathSuccessor()
Dim t As Task
Dim chkTsk As Task
Dim selectedTaskId As Integer

Application.Sort (“Id”)
Application.HighlightSuccessors True

For Each t In ActiveProject.Tasks
selectedTaskId = t.ID
Application.SelectRow Row:=selectedTaskId, RowRelative:=False

t.Text1 = “”

If Not (ActiveSelection.Tasks Is Nothing) Then

For Each chkTsk In ActiveProject.Tasks
If Not (chkTsk.ID = selectedTaskId) Then
If chkTsk.PathSuccessor Then
t.Text1 = t.Text1 & ” ” & chkTsk.ID
End If
End If
Next chkTsk

t.Text1 = t.Text1 & ” ” & t.ID
End If
Next t

Application.HighlightSuccessors False
End Sub
2. You may get an error because ” quotes will not be pasted properly. Correct it.
3. Save and close the VBA editor
4. Click View, Macros, View Macros > select DisplayPathSuccessor and run. This will set the successor path in Text1 column.
5. Insert Text1 column to view the Successor path