P
Prasad Basani
Hi,
I am reading task and subtask information from an Access database. I have to
insert these tasks and subtasks into Project. I am using the following code
to insert a new task and set the font and then a subtask.
Dim newTask As Task
Set newTask = ActiveProject.Tasks.Add(rs!TaskName)
newTask.Number1 = rs!ProjectID
SelectRow Row:=3, RowRelative:=False
Font Name:="Arial", Size:=8, Bold:=True, Color:=pjGreen
Dim subTask As Task
Set subTask = ActiveProject.Tasks.Add("SubTask")
subTask.OutlineIndent
subTask.Start = CDate(rs!InqDate)
subTask.Milestone = True
My newly inserted task is the 3rd row from the top in the .mpp file. That is
the reason why I used Row:=3 in the SelectRow method. But the problem is I
don't know this value at runtime. I tried newTask.ID and newTask.UniqueID but
those do not represent the position (=3) of the newly inserted task. So, I
have to know the position of this row from the top when I insert this row.
Also, I have to set the GanttBarStyle for the subtask. I think I can do this
only after selecting the subTask.
Is there any better way to achieve this? Any help is appreciated!
Thanks
Prasad
I am reading task and subtask information from an Access database. I have to
insert these tasks and subtasks into Project. I am using the following code
to insert a new task and set the font and then a subtask.
Dim newTask As Task
Set newTask = ActiveProject.Tasks.Add(rs!TaskName)
newTask.Number1 = rs!ProjectID
SelectRow Row:=3, RowRelative:=False
Font Name:="Arial", Size:=8, Bold:=True, Color:=pjGreen
Dim subTask As Task
Set subTask = ActiveProject.Tasks.Add("SubTask")
subTask.OutlineIndent
subTask.Start = CDate(rs!InqDate)
subTask.Milestone = True
My newly inserted task is the 3rd row from the top in the .mpp file. That is
the reason why I used Row:=3 in the SelectRow method. But the problem is I
don't know this value at runtime. I tried newTask.ID and newTask.UniqueID but
those do not represent the position (=3) of the newly inserted task. So, I
have to know the position of this row from the top when I insert this row.
Also, I have to set the GanttBarStyle for the subtask. I think I can do this
only after selecting the subTask.
Is there any better way to achieve this? Any help is appreciated!
Thanks
Prasad