Predecessor and sucessor lists based on custom fields

G

Greg Hackman

Hi,

Our planners like to use acctivity ID's, or ActID, as a
unique numerical code for a task. These numbers are
arbitrary and are not in any way linked to an outline
level as the WBS codes are. Currently I'm using custom
field Text1 for this ActID. In my Gantt chart I'd like to
display the successors and predecessors by their ActID's,
rather than by ID or WBS ID.

Is there a sample code out there demonstrating how I could
inspect the list of predessors (or successors) for a task,
find the value of a Text1 in each of those tasks, and then
calculate a custom field which is a list of those Text1
values? Such a code must already exist for WBS
Predecessors.

thanks
 
G

Gérard Ducouret

Hello Greg,
Have a look at this little sample of VBA code :

Sub Predecessors()
Dim Pred As Object, ListPred As String
Debug.Print ActiveCell.Task.Predecessors

For Each Pred In ActiveCell.Task.TaskDependencies
If Pred.From.ID <> ActiveCell.Task.ID Then 'Eliminate the narcissistic
task
Debug.Print Pred.From.ID, Pred.From.Name, Pred.From.Text1
ListPred = Pred.From.Text1 & "; " & ListPred
End If
Next
Debug.Print ListPred
End Sub

Nb : it works only for the selected task. You'll have to adapt it to run
trough all the tasks.
Hope this helps,

Gérard Ducouret
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top