Task must complete on 1 Day or Week

J

JohnV

I am running MS Project 2003 Standard. I am new to MS Project and VBA in MS
Project, but I have extensive experience in Access and Excel. Can some one
point me in the best way to achieve the follow.

1. A task (such as training) must be completed on 1 day. So, if I assign 1
day to the duration, then the training should start on the next available 8
hour day. The task should not flow across days.

2. A task (such as 3 training days) must be completed within the same work
week. If the that takes 3 days and the predecessor completes on a Wednesday
or later, then I want the task to look for the following Monday / Tuesday.

The reason I need to do this is because some persons who are needed at a
certain stage of a project will be required to undergo training. That
training can only be completed after certain predecessor tasks have been
completed. I want this calculation to be triggered whenever I change start
dates or durations of certain tasks. This will make sure that I do not have
to manually adjust the start dates.
 
J

John

JohnV said:
I am running MS Project 2003 Standard. I am new to MS Project and VBA in MS
Project, but I have extensive experience in Access and Excel. Can some one
point me in the best way to achieve the follow.

1. A task (such as training) must be completed on 1 day. So, if I assign 1
day to the duration, then the training should start on the next available 8
hour day. The task should not flow across days.

2. A task (such as 3 training days) must be completed within the same work
week. If the that takes 3 days and the predecessor completes on a Wednesday
or later, then I want the task to look for the following Monday / Tuesday.

The reason I need to do this is because some persons who are needed at a
certain stage of a project will be required to undergo training. That
training can only be completed after certain predecessor tasks have been
completed. I want this calculation to be triggered whenever I change start
dates or durations of certain tasks. This will make sure that I do not have
to manually adjust the start dates.

JohnV,
It sounds like you are responding to my comment in the main newsgroup
about using VBA for this. I wrote a simpler version of what you want a
couple years ago. You would need to modify it be only look at training
tasks and at the finish date and time of predecessors to those tasks.
The TaskDependency Property of the Task object will help with the latter.

'This macro ensures all tasks start at 8:00 am by shifting them as
necessary
' to the next day. Note: it does leave a start-no-earlier-than
constraint
' on all shifted tasks
'written by John 10/27/04 10:00 am
Sub NextDayA()
'cycle through each task
For Each t In ActiveProject.Tasks
'skip over blank lines
If Not t Is Nothing Then
'only look at Start time of non-summary tasks
If t.Summary = False Then
'modifiy Start time of all tasks that do not start first
thing in morning
If InStr(1, t.Start, "8:00:00 am") = 0 Then
NxtDayStrt = Application.DateAdd(t.Start, "1d")
t.Start = CDate(Mid(NxtDayStrt, 1, InStr(1, NxtDayStrt,
" ")) & "8:00:00 am")
End If
End If
End If
Next t
End Sub

In pseudo code, this is the outline
1. Either loop through all tasks in the project or just the subset that
represents training tasks. A filter can be used to find the subset.
2. Check the finish date, including the time, of predecessor tasks.
3. If the finish date and/or time will cause a single day training task
to start later than 8:00 am (normal default start time for standard 8
hour workday), move the start date of the training to the next working
day.
4. Do a similar thing for the 3 day training classes.

Hope this helps you get started.

John
Project MVP
 

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