Variable Deadline Date

J

Jim Aksel

We have contactual requirements to submit documentation to our customer for
review. The customer reviews the document and makes comments (no time
limits, but usually about 5 weeks). Once our customer gives us their
comments, we have 30 days to incorporate the comments and resubmit the
documentation.

I can generate my own schedule logic to reach the "resubmit" milestone and
have that take 30ed. However, I would like to set a deadline on that final
resubmit milestone based on the other milestone of "comments received"[Actual
Finish]

Here is what I have.. I select the "resubmit" milestone task and run this
macro:

Sub Macro2()
SelectTaskField Row:=0, Column:="Deadline"
SetTaskField Field:="Deadline", Value:="7/27/2007"
End Sub

However, Value is a string that must evaluate to a date. What I want is
something more like this:
Sub Macro2()
SelectTaskField Row:=0, Column:="Deadline"
'Throw up a form that asks for the ID number of the predecessor
SetTaskField Field:="Deadline", Value:=str(projdateadd([Actual Finish of
Another task],30ed, "Normal Calendar"))
End Sub

I certainly know the predecessor task, I even know its TaskID. So, what's a
good way to handle this? Should I expose a form that asks for the ID number
of the predecessor and the requested offset? If I do that, I need to put a
formula into the above Macro and I was wondering if someone could volunteer a
few random rants about what I should use for that formula.

One other tweak -- 30ed cannot land on a non-work day in a special calendar.
I guess I will settle for 20d instead of 30ed.
 
R

Rod Gill

Hi,

So you know by the looks of it you have the Task with the deadline selected
before you run the macro?
The Task with the deadline only has the required comments received task as a
predecessor?

If so the following should work:

Sub Macro2()
Dim Tsk As Task
Set Tsk = ActiveCell.Task.PredecessorTasks(1)
ActiveCell.Task.Deadline = DateAdd("d", 30, CDate(Tsk.Finish))
End Sub


--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx
 
J

Jim Aksel

It looks like it will work, here is what I did--
TaskA (comments received)
TaskB (update)
TaskC (review/signatures)
TaskD (final submittal)

There are predecessors to cascade these.. A,B,C,D.

Added a predecessor to "D" so precedecessors to D are now A & C instead of
just C.
Your macro appears to work fine on TaskD as long as "A" is listed as the
first predecessor.

So, all I need to do now is make the "30" and PredecessorTasks(1) variables
and I am all set.

Thanks Rod, if I run into more trouble I will post back.




Rod Gill said:
Hi,

So you know by the looks of it you have the Task with the deadline selected
before you run the macro?
The Task with the deadline only has the required comments received task as a
predecessor?

If so the following should work:

Sub Macro2()
Dim Tsk As Task
Set Tsk = ActiveCell.Task.PredecessorTasks(1)
ActiveCell.Task.Deadline = DateAdd("d", 30, CDate(Tsk.Finish))
End Sub


--

Rod Gill
Project MVP

Project VBA Book, for details visit:
http://www.projectvbabook.com

NEW!! Web based VBA training course delivered by me. For details visit:
http://projectservertraining.com/learning/index.aspx


----------------------------------------------------------------------------------------------------


Jim Aksel said:
We have contactual requirements to submit documentation to our customer
for
review. The customer reviews the document and makes comments (no time
limits, but usually about 5 weeks). Once our customer gives us their
comments, we have 30 days to incorporate the comments and resubmit the
documentation.

I can generate my own schedule logic to reach the "resubmit" milestone and
have that take 30ed. However, I would like to set a deadline on that
final
resubmit milestone based on the other milestone of "comments
received"[Actual
Finish]

Here is what I have.. I select the "resubmit" milestone task and run this
macro:

Sub Macro2()
SelectTaskField Row:=0, Column:="Deadline"
SetTaskField Field:="Deadline", Value:="7/27/2007"
End Sub

However, Value is a string that must evaluate to a date. What I want is
something more like this:
Sub Macro2()
SelectTaskField Row:=0, Column:="Deadline"
'Throw up a form that asks for the ID number of the predecessor
SetTaskField Field:="Deadline", Value:=str(projdateadd([Actual Finish
of
Another task],30ed, "Normal Calendar"))
End Sub

I certainly know the predecessor task, I even know its TaskID. So, what's
a
good way to handle this? Should I expose a form that asks for the ID
number
of the predecessor and the requested offset? If I do that, I need to put
a
formula into the above Macro and I was wondering if someone could
volunteer a
few random rants about what I should use for that formula.

One other tweak -- 30ed cannot land on a non-work day in a special
calendar.
I guess I will settle for 20d instead of 30ed.
 

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