Default Date of Today in Form Field

  • Thread starter Thread starter Mark Leffler
  • Start date Start date
M

Mark Leffler

I have a form with a date field. In the Field Options dialog box Word seems
to allow for a default date. I would like this to be the current date, but
allow users to override with another date if they wish. However, when I try
to use a field like {DATE} in the default date box, I get an error message
(something like "Insert a valid date") when I click OK. Even ={DATE} doesn't
work. I don't want the Type: to be today's date, because then the field is
not available for changing to another date.
What's the way to make this work?
Thanks in advance.
Mark Leffler
 
Hi Mark,

Run a macro containing the following code on entry to the formfield (assumed
in this code to have the bookmark name of Text1):

If Not IsDate(ActiveDocument.FormFields("Text1").Result) Then
ActiveDocument.FormFields("Text1").Result = Format(Date, "d MMMM yyyy")
End If

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