Date field questoin

P

Phil Hunt

I know how to put the create date or system date on the word doc. But is
there a way to show the date + 15 days.

Thanks
 
C

Charles Kenyon

Yes. A complex field. The following gives you the date 15 days after the
creation date:

{ QUOTE "{ SET " Delay" "15" }
{ SET "DaysInMonth" { IF { CreateDate \@ "MM" } <> 2
{ = ROUND(30.575*{ CreateDate \@ "MM" },0)-
ROUND(30.575*{ = { CreateDate \@ "MM" } -1 },0) }
{ IF { = MOD( { CreateDate \@"yy" } , 4 ) } > 0 "28" "29" } } }
{ SET "NextMonth" { IF { CreateDate \@ "MM" } = 12 "1/97"
"{ = { CreateDate \@ "MM" } + 1 }/97 } }
{ IF { = { REF "Delay" } + { CreateDate \@ "dd" } } <= {
REF"DaysInMonth" }
{ CreateDate \@ "MMMM { = { REF "Delay" } + { CreateDate \@ "dd" } },
yyyy"}{ QUOTE { NextMonth \@ "MMMM" }
{ = { REF "Delay" } + { CreateDate \@ "dd" } - { REF"DaysInMonth" } },
{ IF { CreateDate \@ "MM" } <> 12 { CreateDate \@ "yyyy" }
{ CreateDate \@ "{ = 1 + { CreateDate \@ "yyyy" } \# "xxxx" }" } } } }" }

This field was created using Chris Woodman's Add-In. <URL:
http://www.chriswoodman.co.uk/Delayed Dates.htm> I wouldn't recommend
trying to enter it manually. Otherwise, download the document at <URL:
http://www.wopr.com/w3tfiles/10-249902-DateCalc.zip>for good examples of
date field calculations that you can copy and modify to fit.


--

Charles Kenyon

See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
P

Phil Hunt

Are you serious? It's complex alright.
Charles Kenyon said:
Yes. A complex field. The following gives you the date 15 days after the
creation date:

{ QUOTE "{ SET " Delay" "15" }
{ SET "DaysInMonth" { IF { CreateDate \@ "MM" } <> 2
{ = ROUND(30.575*{ CreateDate \@ "MM" },0)-
ROUND(30.575*{ = { CreateDate \@ "MM" } -1 },0) }
{ IF { = MOD( { CreateDate \@"yy" } , 4 ) } > 0 "28" "29" } } }
{ SET "NextMonth" { IF { CreateDate \@ "MM" } = 12 "1/97"
"{ = { CreateDate \@ "MM" } + 1 }/97 } }
{ IF { = { REF "Delay" } + { CreateDate \@ "dd" } } <= {
REF"DaysInMonth" }
{ CreateDate \@ "MMMM { = { REF "Delay" } + { CreateDate \@ "dd" } },
yyyy"}{ QUOTE { NextMonth \@ "MMMM" }
{ = { REF "Delay" } + { CreateDate \@ "dd" } - { REF"DaysInMonth" } },
{ IF { CreateDate \@ "MM" } <> 12 { CreateDate \@ "yyyy" }
{ CreateDate \@ "{ = 1 + { CreateDate \@ "yyyy" } \# "xxxx" }" } } } }" }

This field was created using Chris Woodman's Add-In. <URL:
http://www.chriswoodman.co.uk/Delayed Dates.htm> I wouldn't recommend
trying to enter it manually. Otherwise, download the document at <URL:
http://www.wopr.com/w3tfiles/10-249902-DateCalc.zip>for good examples of
date field calculations that you can copy and modify to fit.


--

Charles Kenyon

See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
C

Charles Kenyon

You asked! That is what it takes, primarily because of the complexities of
the Gregorian calendar combined with fields' use of text for dates rather
than the arbitrary number process used in vba. That's why I use the (free)
Add-In to write the field. It is a very straight-forward process. The
document I gave you the link to has even more flexibility but might be
harder to use.
--

Charles Kenyon

See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
P

Phil Hunt

Thanks. ACtually I create the doc in VB, so I think I just use a bookmark
for this purpose.
 
D

Doug Robbins - Word MVP

As you are already making use of vba, use the DateAdd() function.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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