Default to Today's date in a form

A

Andy

I want a date field of a Word 2003 form to default to today's date. I put in
{DATE} in the default date property but I get "A valid date or time is
required". Is there a way to do this? Thanks.

Andy
 
G

Graham Mayor

Either put a DATE field or a CREATEDATE field in the template where you want
the date to appear, or if you want today's date in a Date formfield, set the
formfield type to 'Current Date'. If you want to start with Today's date,
and allow the user to change that date to some other date, you will need
instead an on-entry macro to fill the date eg assuming the text field is
bookmarked "Date1", the following will insert the current
date in that field when you tab into it, in the format of the switch - here
"dd\MM\yyyy"


Sub SetDate()
Dim sDate As Date
sDate = Format((Now), "dd/MM/yyyy")
ActiveDocument.FormFields("Date1").Result = sDate
End Sub

http://www.gmayor.com/installing_macro.htm


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