Show predecessor name

M

Mike M

Not certain if I'm asking this right..

When I am in Gnatt chart view on the entry table I want to add a column to show the Predecessor name (not task ID number). There is no selection for this in the Insert Column dialog. How can I either display that value, or store it in a text field?
 
M

Mark Durrenberger

Hi,

I know this can be done with VBA. I'm not postive but it might be doable
with an "equation" in a custom text field (i.e. text20).

Mark

--
_________________________________________________________
Mark Durrenberger, PMP
Principal, Oak Associates, Inc, www.oakinc.com
"Advancing the Theory and Practice of Project Management"
________________________________________________________

The nicest thing about NOT planning is that failure
comes as a complete surprise and is not preceded by
a period of worry and depression.

- Sir John Harvey-Jones
Mike M said:
Not certain if I'm asking this right...

When I am in Gnatt chart view on the entry table I want to add a column to
show the Predecessor name (not task ID number). There is no selection for
this in the Insert Column dialog. How can I either display that value, or
store it in a text field?
 
J

JackD

Not possible in a custom text field.
An easy way to see this is to go to the window menu, select split, click in
the bottom pane to activate it, right click and set it to show predecessors
and successors.
Or select the bottom pane and then go to the view menu and find the network
relationship view.

-Jack
 
J

John

Mike,
This simple VBA code will put the predecessor task name in the spare
Text15 field. Be aware though that this code only works on the first
predecessor of a task. If there is more than one predecessor, the code
will need to be modified (and Text15 might get rather "full").

Sub PredName()
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
If t.Predecessors <> "" Then t.Text15 =
t.TaskDependencies(1).From.Name
End If
Next t
End Sub

Hope this helps.
John
 
M

Mike M

Thanks for the code snippet. I do need all predecessors, so I wrote the following

Sub PredName(
Dim t As Tas
Dim tdep As TaskDependenc

For Each t In ActiveProject.Task
If Not t Is Nothing The
If t.Predecessors <> "" The
For Each tdep In t.TaskDependencie
t.Text15 = t.Text15 & "(" & tdep.From.ID & ") " & tdep.From.Name & "
Next tde
End I
End I
Next
End Su

On milestone tasks it is included as a predecessor to itself and is repeated several times. Is there a task type or some thing else to check? Should I exclude the predecessor if the "from.id" is the same a "t.id"? Why are they showing up in the first place?
 
D

Dominic Moss

Mike,

In addition to the advice about creating a split screen view where you can
show the Gantt Chart and the relevant tasks predecessors and successors I
favour creating a combination view (View, More Views, New) which includes
the Gantt Chart in the upper half of the screen and the Relationship Diagram
in the lower half of the screen. This view provides a useful visual check to
ensure that you have got predecessors and successors the right way around
and that there is "contuguity" through your schedule - every single TASK
(please do not link summary tasks to or from anything unless you want a heap
of trouble) with the exception of the first and last task should ideally
have at least one predecessor and one successor (at the same time try to
keep the number of dependencies to the absolute minimum to avoid chaos
creeping into your schedule by accident) to ensure a continuous sequence
through the schedule.

I was taught network planning techniques years ago and this approach has
served me well and avoids what I call loose end or orphan tasks - tasks with
a predecessor but no successor, tasks which put crudely don't matter if they
don't finish!! - That is the inference of there being no successor. In cases
where there is no obvious successor I tend to use Milestones at the end of
each stage. phase or section to mark a definite point in the schedule when
the relevant package of works can be demonstrated to be complete. Linking
"Orphan" tasks to milestones should not make such tasks critical in the main
but will reduce the amount of slack or float available to them so that they
can only slip a bit before it becomes evident there is a problem.

--
Dominic Moss

www.projectability.co.uk

Helping people achieve more with Microsoft Project

Tel +44 8707 303 400
Fax +44 8707 303 500
Mike M said:
Not certain if I'm asking this right...

When I am in Gnatt chart view on the entry table I want to add a column to
show the Predecessor name (not task ID number). There is no selection for
this in the Insert Column dialog. How can I either display that value, or
store it in a text field?
 
M

Mike M

OK, I kept at it and came up with the following. I had to test and truncate if I ran over 255 characters

Sub PredName(
Dim t As Tas
Dim tdep As TaskDependenc
Dim mytext As Strin

For Each t In ActiveProject.Task
If Not t Is Nothing The
If t.Predecessors <> "" The
t.Text15 = "
For Each tdep In t.TaskDependencie
If Not tdep Is Nothing The
mytext = "(" & tdep.From.ID & ") " & tdep.From.Name & "
If t.ID <> tdep.From.ID The
If Len(t.Text15) < 256 The
If Len(t.Text15) + Len(mytext) <= 256 The
t.Text15 = t.Text15 & mytex
Els
t.Text15 = t.Text15 & Left(mytext, 255 - Len(t.Text15)
End I
End I
End I
End I
Next tde
End I
End I
Next
End Sub
 
Joined
Dec 5, 2017
Messages
1
Reaction score
0
Re: Show predecessor name (resolved)

OK, I kept at it and came up with the following. I had to test and truncate if I ran over 255 characters

Sub PredName(
Dim t As Tas
Dim tdep As TaskDependenc
Dim mytext As Strin

For Each t In ActiveProject.Task
If Not t Is Nothing The
If t.Predecessors <> "" The
t.Text15 = "
For Each tdep In t.TaskDependencie
If Not tdep Is Nothing The
mytext = "(" & tdep.From.ID & ") " & tdep.From.Name & "
If t.ID <> tdep.From.ID The
If Len(t.Text15) < 256 The
If Len(t.Text15) + Len(mytext) <= 256 The
t.Text15 = t.Text15 & mytex
Els
t.Text15 = t.Text15 & Left(mytext, 255 - Len(t.Text15)
End I
End I
End I
End I
Next tde
End I
End I
Next
End Sub

Hi Mike, I have tried the above code snippet but still its looping multiple time even for the task with single predecessor and displaying the name repeatedly. Can you help to resolve this
 

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