Date calculations in MS Word Forms

  • Thread starter Thread starter ywolf
  • Start date Start date
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
 
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
 
Back
Top