Gérard Ducouret said:
Are you considering logical links such as Finish-to-Start or
Start-to-Start... ?
If so, you can use the SetTaskField method :
SetTaskField Field:="Predecessors", Value:="2FS+3"
Gérard Ducouret
I commonly use the "add" method which adds a dependency.
Here is the syntax:
expression.Add(From, Type, Lag)
expression Required. An expression that returns a TaskDependencies
collection.
From Required Object. The Task object specified becomes a predecessor of
the task specified with expression.
Type Optional Long. The type of relationship between the linked tasks. Can
be one of the following PjTaskLinkType constants: pjFinishToFinish,
pjFinishToStart, pjStartToFinish, or pjStartToStart. The default value is
pjFinishToStart.
Lag Optional Variant. The duration of lag time between linked tasks. To
specify lead time between tasks, use a negative value. The default value is
0.
an example would be something like
mytask.taskdependencies.Add(activeproject.tasks(1), pjFinishToStart)