Different Finish date in VBA than shown in MS Project itself

M

mwetzel

Under certain conditions, I receive a different task finish date in
VBA than MS Project shows in the application itself. The date in VBA
is about 4 days later. It seems to happen when the task has a Finish
on type constraint. Actually, if I look at the constraint date in VBA
it too is the later date. How can I determine the same date in my VBA
application that MS Project shows? What is causing this to happen?
 
J

Jan De Messemaeker

Hi,

Not having seen this happen for the last decade, I hav problem believing
it.
In Project, aren't you looking at a different field than finish?
Baselinefinish maybe?

Greetings,

Jan De Messemaeker, Project MVP
 
M

mwetzel

After further investigation, I've determined that this only happens
under a certain set of circumstances. First, the default start time
and end time must not be set. By that I mean that they must be left
at 12:00am for both start and end time in the project options under
calendar. Then, a constraint must be set for a task with a date only
and no time. In my case it was a Finish no earlier than 6/22/07.
When I read back the constraint date in VBA, it says 6/26/07 1:13:30
PM. If I specify the time when I specify the constraint, then
everything works as it should. If I set the default finish time to
4:00 PM, then everything works as it should if I then specify the
constraint date without a time.

It is almost as if the save date:time for the constraint is faulty
when their is no valid time entered or no valid default time. I could
be that the time field is larger than 1 day. Could it possibly be 4.5
days?
 
J

Jan De Messemaeker

I repeated your steps exactly (2003, Professional, SP2) and behold, there is
an anomaly in the bar drawing but VBA Immediate window give me the exact
date and time for the constraint date and the finish date!
 
M

mwetzel

I think I know what's going on now. The Project schedules that have
this problem were created by a data export from another scheduling
tool. The problem occurs when someone modifies one of these files and
doesn't type in a time along with the date (thereby using the default
times in the calendar options). For these files, if I look at the
default start and stop times in the calendar options, they both say
midnight. When I type in a date constraint without a time, the date I
read back in VBA is about 4.5 days later. In other words, if I type
in 5/29/07, I'll read back 6/2/07 1:13:30 PM. Now, if I type in
midnight in the calendar options (12:00 AM) for both start and stop
times, subsequent dates entered without times come out fine.

Anyway, the mystery is somewhat understood. The problem is not
solved, but I think a workaround would be to set the defaults in any
of these files BEFORE anyone might enter in a date without a time.

Thanks for your help,
Mark
 
J

Jan De Messemaeker

Hi Mark,

Import or not, you should ALWAYS set defaults before entering any task in a
project file.
That is the first thing to do by all means!
Greetings,
 

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