Finding / selecting a task

A

Adam Schmidt

Hi All
I am writing a utility macro that would lead me step by step through the critical path, by jumping to a critical predecessor of a given task. It is easy to find a critical predecessor, but how should I "go to" the task, having its subproject file name and name or ID? There are no methods to select a task by a name, only a row by its number

How can I get something similar to

Dim proj as Projec
Dim t as Tas
'... Set the proj to somethin
'... Set the t to the critical one out of the PredecessorTasks of the "previous task
proj.SelectTask Task:=
'...o
proj.SelectTaskID TaskID:=t.I
'??

Thanks

Ada
proj.Find
 
J

Jack D.

Adam said:
Hi All,
I am writing a utility macro that would lead me step by step through the
critical path, by jumping to a critical predecessor of a given task. It
is easy to find a critical predecessor, but how should I "go to" the
task, having its subproject file name and name or ID? There are no
methods to select a task by a name, only a row by its number.

How can I get something similar to:

Dim proj as Project
Dim t as Task
'... Set the proj to something
'... Set the t to the critical one out of the PredecessorTasks of the
"previous task"
proj.SelectTask Task:=t
'...or
proj.SelectTaskID TaskID:=t.ID
'???

Thanks,

Adam
proj.Find


Take a look at the "Trace" macro on this page. It gives an example of how to
work with tasks and predecessors.

http://masamiki.com/project/macros.htm

You do not need to select tasks to work with them.
Also, there may be more than one critical predecessor... what do you do
then?

--
Please try to keep replies in this group. I do check e-mail, but only
infrequently.
For Macros and other things check http://masamiki.com/project

-Jack Dahlgren, Project MVP
email: J -at- eM Vee Pee S dot COM


+++++++++++++++++++
 
G

Gérard Ducouret

Hello,
May be you could find some inspiration in this VBA procedure which reads the
names of external predecessors of a milestone.
Hope this help,

Gérard Ducouret
PragmaSoft
.................................................
Sub Dépendances()
Dim TaskDep As TaskDependency
Dim NT As String, i As Integer

NT = "Jalon bloqué"
For Each TaskDep In ActiveProject.Tasks(NT).TaskDependencies
If TaskDep.From.Priority > 50 Then
If TaskDep.From.Name <> NT And TaskDep.From.ID <>
ActiveProject.Tasks(NT).ID Then
Debug.Print "Antécédant ou dépendant ID : " & TaskDep.From.ID &
" (" & TaskDep.From.Name & ") " & _
" a une priorité supérieure à 50."
Else
i = i + 1
Debug.Print "Successeur " & i
End If
End If
Next TaskDep
End Sub


Adam Schmidt said:
Hi All,
I am writing a utility macro that would lead me step by step through the
critical path, by jumping to a critical predecessor of a given task. It is
easy to find a critical predecessor, but how should I "go to" the task,
having its subproject file name and name or ID? There are no methods to
select a task by a name, only a row by its number.
 

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