Timescalevalue update gives error 1101

Nov 3, 2019
Reaction score
I want to populate actual work on a resource assignment.
Below is code written to just try the concept. It assigns 8 hours of actual work to each day defined for a resource assignment. The statement: "TSV.Value = 480" results in Error 1101 - 'Application-defined or object-defined error'

Sub TestTSV()
Dim ProjTasts As Tasks
Dim MyTask As Task
Dim TaskDate As Date, TaskTo As Date
Dim TaskAssignments As Assignments
Dim MyAssignment As Assignment
Dim Tsvs As TimeScaleValues
Dim TSV As TimeScaleValue
Set ProjTasks = ActiveProject.Tasks
' find the task
For Each projtask In ProjTasks
'these if statements step through all tasks in the project
TaskDate = projtask.Start
TaskTo = projtask.Finish
If Not (projtask Is Nothing) Then
If projtask.Summary = False Then
' find the assignment
Set TaskAssignments = projtask.Assignments
For Each MyAssignment In TaskAssignments
Set Tsvs = MyAssignment.TimeScaleData(TaskDate, TaskTo, Type:=pjResourceTimescaledActualWork, TimeScaleUnit:=pjTimescaleDays)
For Each TSV In Tsvs
Debug.Print TSV.StartDate, TSV.Value, TSV.EndDate, TSV.Parent, TSV.Index
TSV.Value = 480
Next TSV
Next MyAssignment
End If
End If
Next projtask
End Sub


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

VBA Code - Need Help 8