Use current date in the default date form field option

A

amcferron

I am creating a form and I would like the current date (the day the
user works on the form) to be the default, but I need the user to have
the option to type over that date if necessary.

I am sure this is a simple option, but I can't seem to find the right
way to insert the current date as the date field default option.

Please help!

Thanks
 
J

Jay Freedman

I am creating a form and I would like the current date (the day the
user works on the form) to be the default, but I need the user to have
the option to type over that date if necessary.

I am sure this is a simple option, but I can't seem to find the right
way to insert the current date as the date field default option.

Please help!

Thanks

Place the following macro in the template for your form
(http://www.gmayor.com/installing_macro.htm) and change the form name
in quotes to the name of the actual field in your template.

Sub AutoNew()
ActiveDocument.FormFields("DateField").Result = CStr(Now)
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
A

amcferron

Jay - Thanks so much!

I am afraid I am pretty new to Macros and I am getting Compile Error :
Syntax error.

I changed the field name ... any ideas on how I could have screwed up
something so simple?
 
J

Jay Freedman

Don't try to type the macro into the editor -- it's too easy to make a
mistake without knowing what you're doing. Just copy the three lines
from the post and paste it into the editor, and then change the field
name.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
G

Graham Mayor

Change the field bookmarkname in the form to DateField rather than in the
macro - then it becomes even more difficult to screw it up :)

Note too that this macro goes in the form template and NOT in normal.dot.
Jay did say this in his original post, but it is worth emphasising.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
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