Form field calculations

G

Guest

I created a form letter. The date of the letter is a form field. The due date
for reply is 30 days after the date of the letter. Is it possible to create
a form field for the due date that calculates automatically?
 
G

Guest

Thank you. I was looking for something simpler. Maybe try recreating this
area in a table with words formula functionality. These
 
G

Graham Mayor

Date calculations in fields are complicated. The work has already been done
for you in the link in that web page to
www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902 All you have to do is
copy the field construction from that document and change the delay to the
number of days you want. You can use a REF field to your bookmarked date
field in place of the DATE field in the examples.

The alternative is to run a macro on exit from the date form field that puts
the calculated date in the form. Assuming the date in question if in form
field Text1 and you want the +30 in form field Text2. The following macro
will do that. Change the names of the fields as appropriate:

Sub Add30()
Dim sDate As Date
sDate = ActiveDocument.FormFields("Text1").Result
sDate = Format((sDate + 30), "dd/MM/yyyy")
ActiveDocument.FormFields("Text2").Result = sDate
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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