Calculating dates in Word?

J

JAnderson

Greetings,

I've been having trouble calculating dates in Word. Typically, I used the
guide which is posted as an attachment to the first post here:
http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=wrd&Number=249902

This worked for some time, but whenever I use this guide now, any method of
calculating a date fails to work. I simply do not understand. Sometimes it
will return a date a week or two from when I desire, sometimes a month or
two. It really seems to like April 10, 2008. (My own system date/time is
accurate)

Anyway, I'm trying to calculate the next Tuesday which occurs at least 6
weeks from now. Any suggestions?

Also, I really liked that guide in the above-referenced website; any ideas
why it won't work for me? (I do have my field codes toggled on to view the
code)

Thanks so much,
 
H

H. Druss

JAnderson said:
Greetings,

I've been having trouble calculating dates in Word. Typically, I used the
guide which is posted as an attachment to the first post here:
http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=wrd&Number=249902

This worked for some time, but whenever I use this guide now, any method
of
calculating a date fails to work. I simply do not understand. Sometimes
it
will return a date a week or two from when I desire, sometimes a month or
two. It really seems to like April 10, 2008. (My own system date/time is
accurate)

Anyway, I'm trying to calculate the next Tuesday which occurs at least 6
weeks from now. Any suggestions?

Also, I really liked that guide in the above-referenced website; any ideas
why it won't work for me? (I do have my field codes toggled on to view
the
code)

Thanks so much,

Try this:
*********************************************************************
Private Function GetTuesday(d As Date) As Date
' first add 6 weeks
d = DateAdd("ww", 6, Date)

' loop until d is a Tuesday
Do While Weekday(d) <> 3
d = DateAdd("d", 1, d)
Loop

GetTuesday = d

End Function
***********************************************************************
Good luck
Harold
 
M

macropod

Hi JAnderson,

Are you sure you're running the fields in the tutirial with the correct month/day configuration for your regional settings? This is
explained in the tutorial's Introduction - and there's amacro to switch them between DD-MM-YYYY and MM-DD-YYYY.
 
J

JAnderson

Ah... yes, that should work. By the way, thank you for authoring such an
amazing document.

Any ideas how to calculate 6 weeks from the next Tuesday without using a
macro? I'm trying to use it in a mail merge context. Thanks to all who have
replied,



macropod said:
Hi JAnderson,

Are you sure you're running the fields in the tutirial with the correct month/day configuration for your regional settings? This is
explained in the tutorial's Introduction - and there's amacro to switch them between DD-MM-YYYY and MM-DD-YYYY.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Greetings,

I've been having trouble calculating dates in Word. Typically, I used the
guide which is posted as an attachment to the first post here:
http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=wrd&Number=249902

This worked for some time, but whenever I use this guide now, any method of
calculating a date fails to work. I simply do not understand. Sometimes it
will return a date a week or two from when I desire, sometimes a month or
two. It really seems to like April 10, 2008. (My own system date/time is
accurate)

Anyway, I'm trying to calculate the next Tuesday which occurs at least 6
weeks from now. Any suggestions?

Also, I really liked that guide in the above-referenced website; any ideas
why it won't work for me? (I do have my field codes toggled on to view the
code)

Thanks so much,
 
M

macropod

Hi JAnderson,

To calculate 6 weeks from the next Tuesday (even if today is Tueday), you could use the field from the example titled 'Calculate a
Stepped Date'. Simply make the value in the 'SET Weekday' field 50 (ie '1' for Tuesday + '42' for the 6 weeks + '7' to force the
calculation to start from 1 week hence)

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ah... yes, that should work. By the way, thank you for authoring such an
amazing document.

Any ideas how to calculate 6 weeks from the next Tuesday without using a
macro? I'm trying to use it in a mail merge context. Thanks to all who have
replied,



macropod said:
Hi JAnderson,

Are you sure you're running the fields in the tutirial with the correct month/day configuration for your regional settings? This
is
explained in the tutorial's Introduction - and there's amacro to switch them between DD-MM-YYYY and MM-DD-YYYY.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Greetings,

I've been having trouble calculating dates in Word. Typically, I used the
guide which is posted as an attachment to the first post here:
http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=wrd&Number=249902

This worked for some time, but whenever I use this guide now, any method of
calculating a date fails to work. I simply do not understand. Sometimes it
will return a date a week or two from when I desire, sometimes a month or
two. It really seems to like April 10, 2008. (My own system date/time is
accurate)

Anyway, I'm trying to calculate the next Tuesday which occurs at least 6
weeks from now. Any suggestions?

Also, I really liked that guide in the above-referenced website; any ideas
why it won't work for me? (I do have my field codes toggled on to view the
code)

Thanks so much,
 
J

JAnderson

Works like a charm - thank you.

If I'm using this in a merge context, do you know of any way that I could
use the resulting date as text instead of a field (so the date wouldn't
change if I opened up the document 2 weeks from now)?


macropod said:
Hi JAnderson,

To calculate 6 weeks from the next Tuesday (even if today is Tueday), you could use the field from the example titled 'Calculate a
Stepped Date'. Simply make the value in the 'SET Weekday' field 50 (ie '1' for Tuesday + '42' for the 6 weeks + '7' to force the
calculation to start from 1 week hence)

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ah... yes, that should work. By the way, thank you for authoring such an
amazing document.

Any ideas how to calculate 6 weeks from the next Tuesday without using a
macro? I'm trying to use it in a mail merge context. Thanks to all who have
replied,



macropod said:
Hi JAnderson,

Are you sure you're running the fields in the tutirial with the correct month/day configuration for your regional settings? This
is
explained in the tutorial's Introduction - and there's amacro to switch them between DD-MM-YYYY and MM-DD-YYYY.

--
Cheers
macropod
[MVP - Microsoft Word]


Greetings,

I've been having trouble calculating dates in Word. Typically, I used the
guide which is posted as an attachment to the first post here:
http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=wrd&Number=249902

This worked for some time, but whenever I use this guide now, any method of
calculating a date fails to work. I simply do not understand. Sometimes it
will return a date a week or two from when I desire, sometimes a month or
two. It really seems to like April 10, 2008. (My own system date/time is
accurate)

Anyway, I'm trying to calculate the next Tuesday which occurs at least 6
weeks from now. Any suggestions?

Also, I really liked that guide in the above-referenced website; any ideas
why it won't work for me? (I do have my field codes toggled on to view the
code)

Thanks so much,
 
M

macropod

Hi JAnderson,

Simple - change the 'DATE' expresions in the field to 'CREATEDATE'.

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Works like a charm - thank you.

If I'm using this in a merge context, do you know of any way that I could
use the resulting date as text instead of a field (so the date wouldn't
change if I opened up the document 2 weeks from now)?


macropod said:
Hi JAnderson,

To calculate 6 weeks from the next Tuesday (even if today is Tueday), you could use the field from the example titled 'Calculate
a
Stepped Date'. Simply make the value in the 'SET Weekday' field 50 (ie '1' for Tuesday + '42' for the 6 weeks + '7' to force the
calculation to start from 1 week hence)

--
Cheers
macropod
[MVP - Microsoft Word]


JAnderson said:
Ah... yes, that should work. By the way, thank you for authoring such an
amazing document.

Any ideas how to calculate 6 weeks from the next Tuesday without using a
macro? I'm trying to use it in a mail merge context. Thanks to all who have
replied,



:

Hi JAnderson,

Are you sure you're running the fields in the tutirial with the correct month/day configuration for your regional settings?
This
is
explained in the tutorial's Introduction - and there's amacro to switch them between DD-MM-YYYY and MM-DD-YYYY.

--
Cheers
macropod
[MVP - Microsoft Word]


Greetings,

I've been having trouble calculating dates in Word. Typically, I used the
guide which is posted as an attachment to the first post here:
http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=wrd&Number=249902

This worked for some time, but whenever I use this guide now, any method of
calculating a date fails to work. I simply do not understand. Sometimes it
will return a date a week or two from when I desire, sometimes a month or
two. It really seems to like April 10, 2008. (My own system date/time is
accurate)

Anyway, I'm trying to calculate the next Tuesday which occurs at least 6
weeks from now. Any suggestions?

Also, I really liked that guide in the above-referenced website; any ideas
why it won't work for me? (I do have my field codes toggled on to view the
code)

Thanks so much,
 

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