P
phreed
Here is an interesting problem/bug related to VBA and MS Project.
As near as I can tell there is no simple function to add a child task.
I would have thought the following would do what I wanted/expected.
Set ChildTask = ParentTask.OutlineChildren.Add(Name:=Name)
However, it appears that the Add method for any Tasks Collection always
acts as if the object were "ActiveProject.Tasks"!
I can easily make a function that is close to what I want,
except it adds the new task as first child rather than a last child.
Private Function AddChildTask(ByRef Task As Task, Optional ByRef Name
As String) As Task
Set AddChildTask = Task.OutlineChildren.Add(Name:=Name,
Before:=(Task.ID + 1))
AddChildTask.OutlineLevel = Task.OutlineLevel + 1
End Function
I haven't come up with a simple function to add the new task as a last
child.
As near as I can tell there is no simple function to add a child task.
I would have thought the following would do what I wanted/expected.
Set ChildTask = ParentTask.OutlineChildren.Add(Name:=Name)
However, it appears that the Add method for any Tasks Collection always
acts as if the object were "ActiveProject.Tasks"!
I can easily make a function that is close to what I want,
except it adds the new task as first child rather than a last child.
Private Function AddChildTask(ByRef Task As Task, Optional ByRef Name
As String) As Task
Set AddChildTask = Task.OutlineChildren.Add(Name:=Name,
Before:=(Task.ID + 1))
AddChildTask.OutlineLevel = Task.OutlineLevel + 1
End Function
I haven't come up with a simple function to add the new task as a last
child.