Z
zzqv9p
I want to extract project data into excel. I can extract basic information:
project start & finish date, task names, resource names associated with tasks.
I am trying to build 2 matrices
resource name X YYYY-MMM to contain either effort or cost
when I try to extract cost by resource I get the cost of the resource for
all tasks. can someone direct me on how I can extract into VB the effort &
cost for each resource by date?
I started with this program to dump the contents, but I cannot figure out
which variables will give me the actual days that will be worked on and the
cost
Sheets("TEMP").Select
Range("A2").Select
ActiveProject.Activate
hours_Per_Day = ActiveProject.HoursPerDay
Dim t As Task
Dim ts As tasks
Dim A As Assignment
Set ts = ActiveProject.tasks
For Each t In ts
If Not t Is Nothing Then
' For Each A In t.Assignments
'change the following line to use
'for a different custom field
'rid = A.ResourceID
start_date = t.Start
end_date = t.Finish
num_resources = 0
task_name = t.Name
duration = t.duration
task_cost = t.Cost
For j = 1 To t.Resources.Count
ActiveCell.Offset(0, 0) = task_name
ActiveCell.Offset(0, 1) = start_date
ActiveCell.Offset(0, 2) = end_date
ActiveCell.Offset(0, 3) = t.Resources(j).PeakUnits
ActiveCell.Offset(0, 5) = duration / 60 / hours_Per_Day
ActiveCell.Offset(0, 6) = t.Resources(j).Name
ActiveCell.Offset(0, 7) = t.Resources(j).Cost
ActiveCell.Offset(0, 8) = t.Resources(j).Number5
ActiveCell.Offset(0, 9) = t.Resources(j).Code
ActiveCell.Offset(0, 10) = t.Resources(j).StandardRate
summ_row = summ_row + 1
Range("A" & summ_row).Select
Next
End If
Next t
project start & finish date, task names, resource names associated with tasks.
I am trying to build 2 matrices
resource name X YYYY-MMM to contain either effort or cost
when I try to extract cost by resource I get the cost of the resource for
all tasks. can someone direct me on how I can extract into VB the effort &
cost for each resource by date?
I started with this program to dump the contents, but I cannot figure out
which variables will give me the actual days that will be worked on and the
cost
Sheets("TEMP").Select
Range("A2").Select
ActiveProject.Activate
hours_Per_Day = ActiveProject.HoursPerDay
Dim t As Task
Dim ts As tasks
Dim A As Assignment
Set ts = ActiveProject.tasks
For Each t In ts
If Not t Is Nothing Then
' For Each A In t.Assignments
'change the following line to use
'for a different custom field
'rid = A.ResourceID
start_date = t.Start
end_date = t.Finish
num_resources = 0
task_name = t.Name
duration = t.duration
task_cost = t.Cost
For j = 1 To t.Resources.Count
ActiveCell.Offset(0, 0) = task_name
ActiveCell.Offset(0, 1) = start_date
ActiveCell.Offset(0, 2) = end_date
ActiveCell.Offset(0, 3) = t.Resources(j).PeakUnits
ActiveCell.Offset(0, 5) = duration / 60 / hours_Per_Day
ActiveCell.Offset(0, 6) = t.Resources(j).Name
ActiveCell.Offset(0, 7) = t.Resources(j).Cost
ActiveCell.Offset(0, 8) = t.Resources(j).Number5
ActiveCell.Offset(0, 9) = t.Resources(j).Code
ActiveCell.Offset(0, 10) = t.Resources(j).StandardRate
summ_row = summ_row + 1
Range("A" & summ_row).Select
Next
End If
Next t