VBA assistance required

M

miguelre

Issue that I am having is that the script is copying the predecessor and
successor based on the original script created. I want it to follow the
same logic of the original script (Same task, but for the added item).


SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="2"
SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="3"
SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="4"
SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="5"
SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="6"
SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="7"
SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="8"
SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="9"
SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="9"
SelectTaskField Row:=1, Column:="Predecessors"
ColumnBestFit Column:=3
SelectTaskField Row:=32, Column:="Name"
SelectTaskField Row:=-32, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="11"
SelectTaskField Row:=1, Column:="Predecessors"
SelectRow Row:=31
SelectTaskField Row:=-31, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="12"
SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="13"
SelectTaskField Row:=1, Column:="Predecessors"
SelectTaskField Row:=0, Column:="Finish"
SelectTaskField Row:=0, Column:="Start"
SelectTaskField Row:=0, Column:="Duration"
SelectTaskField Row:=0, Column:="Name"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="14"
SelectTaskField Row:=1, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="15"
SelectTaskField Row:=1, Column:="Predecessors"
SelectTaskField Row:=0, Column:="Finish"
SelectTaskField Row:=0, Column:="Start"
SelectTaskField Row:=0, Column:="Duration"
SelectTaskField Row:=0, Column:="Name"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=1, Column:="Indicators"
SelectTaskField Row:=-1, Column:="Indicators"
SelectTaskField Row:=0, Column:="Name"
SelectTaskField Row:=0, Column:="Duration"
SelectTaskField Row:=0, Column:="Start"
SelectTaskField Row:=0, Column:="Finish"
SelectTaskField Row:=0, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="16"
SelectTaskField Row:=1, Column:="Predecessors"
SelectTaskField Row:=0, Column:="Finish"
SelectTaskField Row:=0, Column:="Start"
SelectTaskField Row:=0, Column:="Duration"
SelectTaskField Row:=0, Column:="Name"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Name"
SelectTaskField Row:=0, Column:="Duration"
SelectTaskField Row:=0, Column:="Start"
SelectTaskField Row:=0, Column:="Finish"
SelectTaskField Row:=0, Column:="Predecessors"
SetTaskField Field:="Predecessors", Value:="17"
SelectTaskField Row:=1, Column:="Predecessors"
SelectTaskField Row:=0, Column:="Finish"
SelectTaskField Row:=0, Column:="Start"
SelectTaskField Row:=0, Column:="Duration"
SelectTaskField Row:=0, Column:="Name"
SelectTaskField Row:=0, Column:="Indicators"
SelectTaskField Row:=0, Column:="Indicators"
 
J

Jan De Messemaeker

Hi,

I wish understood your question.
The issue I have is that you base everything on row numbers rather than on
tasks, but even then, could you be a little more elaborate in what you ask?

Greetings,
 
M

miguelre

Anyway, basically i created this script from the macro recorder and it
is giving a relative reference vs dynamic. I created the macro to add
a series of basic cookie cutter task for the project. I want the same
dependencies,but only related to the information being inserted.

In common language. I have reference a predecessor as 2,3, and 4 in
the original. When I run the macros on line 18 it adds the same task
but is still ref. 2,3, and 4 vs 19,20,21.

Thanks for any assistance rendered.
 
J

Jan De Messemaeker

Hi,

Activeselection.tasks(1).predecessors=cstr(activeselection.tasks(1).id-1)
HTH
 

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