<p>I have somve visual Basic (below) that pulls the resource allocation by resource by week. It works great. I want to add a layer of detail and break it out by task as well, the say way the Resource Usage view shows it.</p><p>Is there
a way I can dump that view, with both Resource and Task, or is there a way to add the task detail to my code?</p><p>thanks</p><p>Not the code bolow is actually in Visual Basic, but in the "Insert code Block" option, I did
not see that so chose VB.net.</p><pre class="prettyprint lang-vb">Sub TimePhasedDataTest_save() Dim tsv_task As TimeScaleValue Dim tsvs_task As TimeScaleValues Dim tsv_res As TimeScaleValue Dim tsvs_res As TimeScaleValues Dim s_Task_Name
As Variant ' Declare a FileSystemObject. Needs Microsoft Scripting Runtime Reference Dim fso As FileSystemObject ' Create a FileSystemObject. Set fso = New FileSystemObject ' Declare a TextStream. Dim stream As TextStream ' Create a TextStream. Set stream
= fso.CreateTextFile("C:\Users\trich\Desktop\TimeScaleData Work.csv", True) Dim l_Number_Of_Resources As Long Dim l_Number_of_Tasks As Long Dim i As Long Dim j As Long Dim s_String As String 'Timephased for Resource l_Number_Of_Resources = ActiveProject.ResourceCount
l_Number_of_Tasks = ActiveProject.Tasks.Count 'Write out the first row of dates so set task to 1, the main summary task Set tsvs_task = ActiveProject.Tasks(1).TimeScaleData( _ StartDate:=ActiveProject.ProjectStart, _ EndDate:=ActiveProject.ProjectFinish, _
Type:=pjTaskTimescaledWork, _ TimeScaleUnit:=pjTimescaleWeeks, Count:=1) stream.Write "," ' this is for the file name column For Each tsv_task In tsvs_task stream.Write "," & Format(tsv_task.StartDate, "Short Date") Next
tsv_task 'now write a blank line to get ready for the resour data below stream.WriteLine "," For j = 1 To l_Number_Of_Resources Set tsvs_res = ActiveProject.Resources(j).TimeScaleData( _ StartDate:=ActiveProject.ProjectStart, _ EndDate:=ActiveProject.ProjectFinish,
_ Type:=pjResourceTimescaledWork, _ TimeScaleUnit:=pjTimescaleWeeks, Count:=1) i = 1 For Each tsv_res In tsvs_res 'Debug.Print ActiveProject.Resources(j).Name, _ Format(tsv.StartDate, "Short Date"), _ Val(tsv.Value) / 60; "" If i = 1 Then
'we have a new resource and need a new line stream.WriteLine s_String = ActiveProject.Name & "," & _ ActiveProject.Resources(j).Name & "," & _ Val(tsv_res.Value) / 60 & "," stream.Write
s_String i = i + 1 Else ' we are continuing with the current resource s_String = Val(tsv_res.Value) / 60 & "," stream.Write s_String End If Next tsv_res Next j stream.Close MsgBox "Processing Complete." End Sub</pre><br
/><p></p>
↧