Linking tasks using VBA

C

Chiel

If available, would appreciate a code snippet that would
demo how tasks are linked in VBA.
 
G

Gérard Ducouret

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
 
J

JackD

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)
 

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