Setting Actual work using TimescaleData objects

V

Vivek Gupta

Hi,

I am setting Actual hours for a given task assignment on a per day basis.I
read Actual start,Actual Finish and Actual hours for a given task assignment
from a text file and set it in mpp accordingly.The actual start and actual
end date is same.

I am facing a peculiar issue for following scenario:

I have a task with duration of 2 days with planned start as 10th feb and
planned end as 11th feb.Now through code I set actual work = 1hrs for 10th
feb and 2 hrs for 11 th feb.As a result Actual start for assignment is set
to 10th feb.Now I clear the actual hrs set on 10th feb.So actual hours is set
to 0 hrs for 10th feb.However I am now expecting Actual start date as 11 th
feb instead of 10th feb.

Is there any way by which I can get the desired result without actually
setting the actual start?

Below is the code snippet to reproduce the issue:
The code sets actuals for the first task and first assignment of that task
in the project.

Dim w_timescaleobj As TimeScaleValue
Dim w_timescalecolln As TimeScaleValues
Dim w_assgnobj As Assignment

'Set act work = 1 hr on 10th feb
Set w_assgnobj = MSProject.ActiveProject.Tasks(1).Assignments(1)
Set w_timescalecolln = w_assgnobj.TimeScaleData("2/10/09", "2/10/09",
pjAssignmentTimescaledActualWork, pjTimescaleDays)
w_timescalecolln.Item(1).Value = 60

'Set act work = 2 hr on 11th feb
Set w_timescalecolln = w_assgnobj.TimeScaleData("2/11/09", "2/11/09",
pjAssignmentTimescaledActualWork, pjTimescaleDays)
w_timescalecolln.Item(1).Value = 120

'Clear act work on 10th feb
Set w_timescalecolln = w_assgnobj.TimeScaleData("2/10/09", "2/10/09",
pjAssignmentTimescaledActualWork, pjTimescaleDays)
w_timescalecolln.Item(1).Clear
 
R

Rod Gill

I think you may find that although you have zero actual work for the tenth,
the Actual Start date remains on the 10th. You need to set percent complete
to zero to clear the actual start date. What ever you have to do manually in
Project to clear the Actual Start Date you will need to do in VBA.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
V

Vivek Gupta

Hi,
% complete can be set to 0 for the task and not for assignment.Also I dont
wish to delete all the actual hours,but just for a given day and that too for
a task assignment so that Actual start changes from 10 th feb to 11 th feb.

Regards,
Vivek Gupta
MCTS For project
 
R

Rod Gill

The task's start won't change unless % complete is zero and there is no
actual start date.

You can clear a timeslice using :
w_timescaleobj .clear I think.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 

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

Top