Date calculations in MS Word Forms

Y

ywolf

I have a form with 12 Date fields in a short format dd/MM/yy. I would
like to enable the form user to fill in the first date field and have
the others filled automatically(same day of the month in consecutive 11
months). How do I do it?
Thank you so much for your help
ywolf
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Hi ywolf,

If the formfields have the bookmark names "Month1", "Month2", ... "Month12"
and if you run a macro containing the following code on exit from the
"Month1" formfield, it will populate the others as required:

Dim i As Long
For i = 2 To 12
ActiveDocument.FormFields("Month" & i).Result = Format(DateAdd("M", i - 1,
ActiveDocument.FormFields("Month1").Result), "dd/MM/yy")
Next i

--
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