So I have a Timeline in Microsoft Excel which contains a variety of information. I created an array of my own custom type which read in this data but now I need to output my array onto Project.
My array consists of a custom datatype as following:
Type customtype
- Summary Name (The subtask would go under their respective summary task)
- Number of subtasks
- Another array called TaskList()
This array called TaskList() would then hold as many subtasks inside as the number of tasks. All subtasks in TaskList for that respective array index belong to the same Summary name and would be in this format:
Type taskList
- Subtask Name
- startDate
- endDate
How would I go about now given that I have all the necessary info (name/summary name/start & end dates) and be able to in VBA automatically loop through and put this into MS Project?
Many thanks,
My custom structs:
Type TimelineInfo
taskName As String
dateStart As Date
dateEnd As Date
End Type
Type resourceSummary
beginningDate As Date
endingDate As Date
resourceName As String
numberOfTasks As Integer
taskList() As TimelineInfo
End Type
The resourceSummary would be the Summary Task, with all tasks in taskList() going underneath that respective resource summary name.
I've declared these two variables,
Dim timelineArray() As TimelineInfo
Dim groupsArray() As resourceSummary
groupsArray is indexed from 0 to 7, meaning that there are 8 summary tasks needed to be made with as many subtasks inside them. The array is already filled with data now I just need to output into project.
z = 1
For i = LBound(groupsArray) To UBound(groupsArray)
For j = 0 To (groupsArray(i).number - 1)
tempName = groupsArray(i).taskList(j).taskName
pj.Tasks.Add Name:=tempName, before:=z
pj.Tasks(z).Start = groupsArray(i).taskList(j).date
pj.Tasks(z).Finish = groupsArray(i).taskList(j).dateEnd
z = z + 1
Next j
Next i
My Problem Above however is that I still need to create summary tasks to put all those subtasks inside. The summary task will be from the resourceSummary custom datatype and will use
beginningDate As Date
endingDate As Date
resourceName As String