hmm..i mean, if you see "task usage view" and you activate the cumulative
work at the right side, you will see that it always incremented every days, i
want create program like that (cumulative work at usage task) and write it to
one field at gantt chart, so my boss can see the report target at the current
date..
Sub CopyActuals()
Dim TSV As TimeScaleValue, TSV2 As TimeScaleValue
Dim TSVs As TimeScaleValues, TSVs2 As TimeScaleValues
Dim Tk As Task
Dim Ass As Assignment
'Dim TStart As Date, TFinish As Date
Dim i As Integer
'==========================================================================================================
Dim MyFile As String
Dim Tampung, Sn As String
Dim JumlahHour, Tamp1, Tamp2 As Long
Dim Hasil As Variant
Dim Persen As Long
MyFile = "C:\" & ActiveProject.Name & "_properties.txt"
fnum = FreeFile()
Open MyFile For Output As fnum
Tampung = ""
JumlahHour = 0
'==========================================================================================================
For Each Tk In ActiveProject.Tasks
i = 0
For Each Ass In Tk.Assignments
i = i + 1
Deb = Tk.Assignments(i).Start
Fin = Tk.Assignments(i).Finish
Set TSVs = Tk.Assignments(i).TimeScaleData("1/1/08",
"4/3/09", pjAssignmentTimescaledWork, pjTimescaleDays, 1)
For Each TSV In TSVs
'==========================================================================================================
If (Tk.Name <> Tampung) Then
Tampung = Tk.Name
End If
If (Tk.Name = Tampung) Then
JumlahHour = JumlahHour + Val(TSV.Value)
End If
'==========================================================================================================
Next TSV
'Write #fnum, Round(Tk.Work / 480, 1), JumlahHour / 480 & ";
d; ", Tk.Name, Ass.ResourceName, Tk.Work / 480; ""
If (Round((JumlahHour / 480), 1) >= Tk.Work) Then
Tamp1 = Round(Tk.Work / 480, 1)
Tamp2 = Round(Tk.Work / 480, 1)
Sn = "A"
If ((Round((JumlahHour / 480), 1) = 0) Or ((Tk.Work) =
0)) Then
Persen = 0
Else
Persen = (Round((JumlahHour / 480), 1) /
Round(Tk.Work / 480, 1)) * 100
If Persen > 100 Then
Persen = 100
End If
End If
End If
If (Round((JumlahHour / 480), 1) < Tk.Work) Then
Tamp1 = Round((JumlahHour / 480), 1)
Tamp2 = Round(Tk.Work / 480, 1)
Sn = "B"
If ((Round((JumlahHour / 480), 1) = 0) Or ((Tk.Work) =
0)) Then
Persen = 0
Else
Persen = (Round((JumlahHour / 480), 1) /
Round(Tk.Work / 480, 1)) * 100
If Persen > 100 Then
Persen = 100
End If
End If
End If
Write #fnum, "Target : " & Tamp1, "Baseline : " & Tamp2,
"Target (%) : " & Persen, Sn, Tk.Name, Tk.Summary, Tk.Index, Tk.OutlineLevel,
DateFormat(Tk.Start, vbLongDate), DateFormat(Date, vbLongDate)
Tk.Text25 = Persen & " %"
Next Ass
Tampung = Tk.Name
JumlahHour = 0
Next Tk
Close #fnum
End Sub