Charles
Wed Dec 14 10:18:38 CST 2005
This is more complex than you might imagine, but it can be done, with or
without vba. See
http://addbalance.com/word/datefields2.htm for information
on the different kinds of ways to make a date calculation work. It includes
links to pages with fields and an explanation of different macros that can
be used instead of fields. The following is a sample field that gives the
date 7 days after the document is created.
{ QUOTE "{ SET " Delay" "7" }
{ 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" }" } } } }" }
Don't try to type this. Read the web pages.
--
Charles Kenyon
Word New User FAQ & Web Directory:
http://addbalance.com/word
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
http://addbalance.com/usersguide
See also the MVP FAQ:
http://word.mvps.org/FAQs/ 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.
"tineke" <tineke@discussions.microsoft.com> wrote in message
news:B89AB497-A0BB-46DE-B3DC-CD176C636ECD@microsoft.com...
> In a contract we fill in a date with the next spec.
>
> type: date
> format: d MMMM yyyy
> bookmark: datum1
> result after fill in: 14 december 2005
>
> Two weeks after this date people have to pay, in the document we will that
> the date is automaticly displayed in the text. I tried already this, and
> many
> other things but nothing does the job
>
> type: calculation
> expression: =Dateadd(date1)+14
> bookmark: datum2
> result bv: 28 december 2005
>
> Who can help me