Timephase redistribution of Work

A

Andy Boruta

I am trying to distribute work evenly between a start date and target date.
My problem is that Project places work AFTER the target date, even though the
timephase period (tsvWork) specifically states the end date (gblEnd). Can
you explain how hours got into Work after gblEnd?

Here are the variables:

x = loop variable for assinment
vTot = that particular resource's totaled availability for the period
vRemWork = Holder for total work (I zero it out before redistribution)
tsvWork = the daily timephase Work object
vDay = a holder for the allocation for the current day

vRemWork =
ActiveProject.Tasks(gblTaskId).Assignments(x).RemainingWork

ActiveProject.Tasks(gblTaskId).Assignments(x).RemainingWork = 0


Set tsvWork =
ActiveProject.Tasks(gblTaskId).Assignments(x).TimeScaleData(gblStart, gblEnd,
_
Type:=pjAssignmentTimescaledWork, TimescaleUnit:=pjTimescaleDays)


For y = 1 To tsvAvail.Count

If tsvAvail(y) <> "" Then
vDay = (vRemWork * (tsvAvail(y) / vTot))
tsvWork(y).Value = vDay

End If
Next y
 
R

Rod Gill

Hi,

If a task finishes halfway through a day, then the last time scaled slice
will be to the end of the last day. To do what you want I wouldn't use
timescaled values at all.

Firstly in Project manually edit the Actual work and remaining work data and
look in Task Usage view to see what needs to be done at a task level to even
the remaining work out, then code that action.

--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.project-systems.co.nz/
Email rodg AT project-systems DOT co DOT nz
 
A

Andy Boruta

The point of what I'm doing is to automatically split the remaining work
evenly among the available days of the task, given the availability of the
resource. For example, if I have 200 hours on a task, the target end date is
a month away, and the resource has a one week vacation in the middle of the
month, this routine would use the available work timephase to split the 200
hours across the month, skipping the week vacation.

It works well most of the time, just the occasional times where it schedules
hours outside of the timephase object. Any suggestions?
 
R

Rod Gill

Try just editing remaining work or remaining duration (ignoring holiday).
Time will be evenly assigned to days remaining.

--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.project-systems.co.nz/
Email rodg AT project-systems DOT co DOT nz
 
A

Andy Boruta

The point of doing this in a macro is to quickly even out the hours. For
that to happen manually, I would have to vary the assignment units until I
get to the target end date. I would much rather just click a button and have
that happen automatically.

Question is still: Why does MSP put hours ourside the defined end date of
the work timephase object?
 
R

Rod Gill

The answer's the same as in my first response. If you work weekly, and have
an end date on a Wednesday, the last time phased period will still be to the
end of the week, hence hours after your original end date. Single step
through your code and look at the start and end dates of the last time
slice. This behaviour is all detailed in help.

I would look again at simply editing remaining work or duration and looking
at the result in Resource usage view. Usually this is quicker and moor
accurate. You need to experiment manually then automate your manual actions.

--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.project-systems.co.nz/
Email rodg AT project-systems DOT co DOT nz
 
A

Andy Boruta

I appreciate your efforts, but the behavior that MSP exhibits goes beyond the
end of the week. The timephase unit is days, and the extraneous hours
sometimes go out over a month past the defined end of the timephase. I don't
want to manually edit the resource view (although I do this to correct the
macro problem when it happens). This seems like a bug. If you can't think
of anything different (or if someone else doesn't have an idea), I'll
probably have to let this one end.

This is the greatest forum for VBA programmers. Most of the time, I solve
my problems from existing posts. This one, though, is a real tough one.
 

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