VBA elapsed duration format

M

Mark

I am trying to obtain whether a duration is an elapsed duration or not from
the vba model. This information is really easy to obtain from the mpd or xml
format, but i cannot seem to find this info in the api.

Any ideas anyone?

Many Thanks

Mark
 
M

Mark

Hi Rod,

Thank you for your reply but maybe you misread my question. I am talking
about 'ELAPSED' durations and not 'ESTIMATED'. These are very different.

Regards

Mark
 
R

Rod Gill

The database and xml formats simply show you the format of the duration
figure in Project. This is useful, but from VBA the only way to tell the
difference is to compare duration values.

Take:
Task1 with duration of 5d
Task1 with duration of 5ed

In the Immediate Window:
?activeproject.Tasks(1).Duration/60/8
5
?activeproject.Tasks(2).Duration/60/8
15

So if the difference between two dates in days is 5 then a duration of 5 is
not elapsed, but a duration of 5*3 must be elapsed.

--

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
 
M

Mark

Good idea, but what happens if a task is on a 7 day calendar. Then the
result will be the same.

Regards

Mark
 
M

Mark

What happens if you are using a non english version of project? Then 'ed'
would be represented by that language equivalent, is that not correct?

Mark
 
G

Gérard Ducouret

Hello Mark and Rod

With the GetField method, you can get the duration unit :

Debug.Print Right(ActiveCell.Task.GetField(pjTaskDuration), 2)

in English version you will find "ed"
in French version you will find "jé"

Hope this helps,

Gérard Ducouret
 
M

Mark

Thanks for the response Gerard, but this does not give a generic answer for
all languages. The problem is that the api does not dispose the duration
format independantly via an enumeration type.

Regards

Mark
 

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