miao,
Your post talks about task assignment hours by week but your example
shows just task hours by week. The first code loop will give task hours
by week and the second will give task assignment hours by week.
Sub TaskHrsTimescale()
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
First = t.Start
Last = t.Finish
Set TaskHrs = t.TimeScaleData(First, Last, _
Type:=pjTaskTimescaledWork, _
timescaleunit:=pjTimescaleWeeks)
For i = 1 To TaskHrs.Count
joe = TaskHrs(i).Value / 60
[put the above value in Excel]
Next i
End If
Next t
End Sub
Sub AssHrsTimescale()
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
For Each A In t.Assignments
If Not A Is Nothing Then
First = A.Start
Last = A.Finish
Set TaskAss = A.TimeScaleData(First, Last, _
Type:=pjAssignmentTimescaledWork, _
timescaleunit:=pjTimescaleWeeks)
For i = 1 To TaskAss.Count
WeeklyHrs = TaskAss(i).Value / 60
[put the above value in Excel]
Next i
End If
Next A
End If
Next t
End Sub
Hope this helps.
John