From: Binoy on
Hi,

Can someone kindly let me know how I can retrieve the text that Microsoft
Project uses for empty date fields using VBA, which works across different
regional settings? For e.g. for a US English installation, the undefined date
value is displayed as "NA".

Is there any property of the activeProject object that I could use for this
purpose? Currently, we use activeProject.Tasks(1).getField(pjTaskStart1) at
the time of initialization of project, but this results in different results
on different machines (NA on most, system date on a few)

Thanks,
Binoy
From: Jim Aksel [MVP] on
I do not know of a universal value or property that you can access. What I
do is try to compare it to something else.
For example, a completed task will have [Finish]=[Actual Finish]. A task
that is not yet finished will have [Actual Finish]="NA" or what ever "NA" is
for the given language pack.

So, if I want to test if a task is complete, I don't test for [Actual
Finish]="NA" ... Instead I test if [Finish]=[Actual Finish]. For certain
the value of [Finsih] can never equal NA.

However, that gets a little trickier for things like baselines... how do I
know if I have a baseline date? One other thing I found was when testing
for "NA", I recognized that "NA" was either smaller than the smallest
possible date, or larger than the largest possible date so I tested on that.
However, I found in VBA and VB.NET the logic seems to reverse.

Hope that helped. Post back if you can't work around it.

Jim Aksel, MVP

"Binoy" <Binoy(a)discussions.microsoft.com> wrote in message
news:54DDB5AB-6CEC-4DCE-90B7-6E61862900D8(a)microsoft.com...
> Hi,
>
> Can someone kindly let me know how I can retrieve the text that Microsoft
> Project uses for empty date fields using VBA, which works across different
> regional settings? For e.g. for a US English installation, the undefined
> date
> value is displayed as "NA".
>
> Is there any property of the activeProject object that I could use for
> this
> purpose? Currently, we use activeProject.Tasks(1).getField(pjTaskStart1)
> at
> the time of initialization of project, but this results in different
> results
> on different machines (NA on most, system date on a few)
>
> Thanks,
> Binoy

From: Binoy on
Hi Jim,

Thank you for replying.

The suggested workaround however will not work in my case. What I have is a
function which takes a variant (dates) as an argument and then converts it
into a specific date format (which is then returned as a string).

Before I parse the date, I need to verify two conditions on the input
argument,
1) it is not empty
2) it is defined (i.e. not "NA")

I need some way to accomplish (2) which works across all regional
settings/locales. What I am thinking is that I could take this value from
some unused date field in Microsoft Project for comparison.

Please advise.

Thanks in Advance & Merry Xmas,
Binoy

"Jim Aksel [MVP]" wrote:

> I do not know of a universal value or property that you can access. What I
> do is try to compare it to something else.
> For example, a completed task will have [Finish]=[Actual Finish]. A task
> that is not yet finished will have [Actual Finish]="NA" or what ever "NA" is
> for the given language pack.
>
> So, if I want to test if a task is complete, I don't test for [Actual
> Finish]="NA" ... Instead I test if [Finish]=[Actual Finish]. For certain
> the value of [Finsih] can never equal NA.
>
> However, that gets a little trickier for things like baselines... how do I
> know if I have a baseline date? One other thing I found was when testing
> for "NA", I recognized that "NA" was either smaller than the smallest
> possible date, or larger than the largest possible date so I tested on that.
> However, I found in VBA and VB.NET the logic seems to reverse.
>
> Hope that helped. Post back if you can't work around it.
>
> Jim Aksel, MVP
>
> "Binoy" <Binoy(a)discussions.microsoft.com> wrote in message
> news:54DDB5AB-6CEC-4DCE-90B7-6E61862900D8(a)microsoft.com...
> > Hi,
> >
> > Can someone kindly let me know how I can retrieve the text that Microsoft
> > Project uses for empty date fields using VBA, which works across different
> > regional settings? For e.g. for a US English installation, the undefined
> > date
> > value is displayed as "NA".
> >
> > Is there any property of the activeProject object that I could use for
> > this
> > purpose? Currently, we use activeProject.Tasks(1).getField(pjTaskStart1)
> > at
> > the time of initialization of project, but this results in different
> > results
> > on different machines (NA on most, system date on a few)
> >
> > Thanks,
> > Binoy
>
>
From: "Steve House [MVP]" sjhouse at hotmail dot on
What is the actual end result you're trying to achieve here - load a
variable with the actual text used in the current version so you can display
it later or are you trying to create a constant to later compare to see if a
field either contains a date entry or displays "NA" or the local version
equivalent?

If the object is to test whether a date field contains a valid date or is
displaying NA, try the IsDate function. For example, in a project file
containing 1 task, the expression IsDate(ActiveProject.Task(1).ActualFinish)
returns True if a finish date has been entered and False if it's showing NA.
Does that help get you where you need to be?
--
Steve House [Project MVP]
MS Project Trainer & Consultant
Visit http://project.mvps.org/faqs.htm for the FAQs


"Binoy" <Binoy(a)discussions.microsoft.com> wrote in message
news:54DDB5AB-6CEC-4DCE-90B7-6E61862900D8(a)microsoft.com...
> Hi,
>
> Can someone kindly let me know how I can retrieve the text that Microsoft
> Project uses for empty date fields using VBA, which works across different
> regional settings? For e.g. for a US English installation, the undefined
> date
> value is displayed as "NA".
>
> Is there any property of the activeProject object that I could use for
> this
> purpose? Currently, we use activeProject.Tasks(1).getField(pjTaskStart1)
> at
> the time of initialization of project, but this results in different
> results
> on different machines (NA on most, system date on a few)
>
> Thanks,
> Binoy

From: John on
In article <C258E62E-1691-4A3D-883B-DFD92BE8D853(a)microsoft.com>,
Binoy <Binoy(a)discussions.microsoft.com> wrote:

> Hi Jim,
>
> Thank you for replying.
>
> The suggested workaround however will not work in my case. What I have is a
> function which takes a variant (dates) as an argument and then converts it
> into a specific date format (which is then returned as a string).
>
> Before I parse the date, I need to verify two conditions on the input
> argument,
> 1) it is not empty
> 2) it is defined (i.e. not "NA")
>
> I need some way to accomplish (2) which works across all regional
> settings/locales. What I am thinking is that I could take this value from
> some unused date field in Microsoft Project for comparison.
>
> Please advise.
>
> Thanks in Advance & Merry Xmas,
> Binoy
Binoy,
Probably the easiest way to determine if a Project field has a valid
date is by using the IsDate function. If the value in the field,
(including fields with "NA"), can be converted to or is recognized as a
date, the function will return "true". If not, it will return "false".
This should also make the code language independent.

Once you know you have a valid date, you can then do your conversion to
whatever date format you want.

Hope this helps.
John
Project MVP
>
> "Jim Aksel [MVP]" wrote:
>
> > I do not know of a universal value or property that you can access. What I
> > do is try to compare it to something else.
> > For example, a completed task will have [Finish]=[Actual Finish]. A task
> > that is not yet finished will have [Actual Finish]="NA" or what ever "NA"
> > is
> > for the given language pack.
> >
> > So, if I want to test if a task is complete, I don't test for [Actual
> > Finish]="NA" ... Instead I test if [Finish]=[Actual Finish]. For certain
> > the value of [Finsih] can never equal NA.
> >
> > However, that gets a little trickier for things like baselines... how do I
> > know if I have a baseline date? One other thing I found was when testing
> > for "NA", I recognized that "NA" was either smaller than the smallest
> > possible date, or larger than the largest possible date so I tested on
> > that.
> > However, I found in VBA and VB.NET the logic seems to reverse.
> >
> > Hope that helped. Post back if you can't work around it.
> >
> > Jim Aksel, MVP
> >
> > "Binoy" <Binoy(a)discussions.microsoft.com> wrote in message
> > news:54DDB5AB-6CEC-4DCE-90B7-6E61862900D8(a)microsoft.com...
> > > Hi,
> > >
> > > Can someone kindly let me know how I can retrieve the text that Microsoft
> > > Project uses for empty date fields using VBA, which works across
> > > different
> > > regional settings? For e.g. for a US English installation, the undefined
> > > date
> > > value is displayed as "NA".
> > >
> > > Is there any property of the activeProject object that I could use for
> > > this
> > > purpose? Currently, we use activeProject.Tasks(1).getField(pjTaskStart1)
> > > at
> > > the time of initialization of project, but this results in different
> > > results
> > > on different machines (NA on most, system date on a few)
> > >
> > > Thanks,
> > > Binoy
> >
> >