From: Mary Fetsch on
In my Word 2007 document, I have a text form with Type equal to 'Date'. Is
there a way I can set the default date to be the current date? (I don't want
to set the Type to 'Current date' because then the user can't change it.)
Thanks!

Mary Fetsch
From: Stefan Blom on
This could be done with an "Entry" macro assigned to the form field in
question. What follows is a simple version of such a macro:

Sub TestMacro()
If Trim$(ActiveDocument.FormFields("Text1") _
..Result) = "" Then
ActiveDocument.FormFields("Text1") _
..Result = Format$(Now(), "MMMM DD, YYYY")
End If
End Sub

It is assumed that the bookmark name specified for the field is "Text1"
(which is the default). If you have chosen a different name, you should of
course use that one instead.

--
Stefan Blom
Microsoft Word MVP



"Mary Fetsch" <MaryFetsch(a)discussions.microsoft.com> wrote in message
news:D46D06CE-254A-4C25-8085-FC91006D275D(a)microsoft.com...
> In my Word 2007 document, I have a text form with Type equal to 'Date'.
> Is
> there a way I can set the default date to be the current date? (I don't
> want
> to set the Type to 'Current date' because then the user can't change it.)
> Thanks!
>
> Mary Fetsch




From: Mary Fetsch on
Thanks so much!

"Stefan Blom" wrote:

> This could be done with an "Entry" macro assigned to the form field in
> question. What follows is a simple version of such a macro:
>
> Sub TestMacro()
> If Trim$(ActiveDocument.FormFields("Text1") _
> ..Result) = "" Then
> ActiveDocument.FormFields("Text1") _
> ..Result = Format$(Now(), "MMMM DD, YYYY")
> End If
> End Sub
>
> It is assumed that the bookmark name specified for the field is "Text1"
> (which is the default). If you have chosen a different name, you should of
> course use that one instead.
>
> --
> Stefan Blom
> Microsoft Word MVP
>
>
>
> "Mary Fetsch" <MaryFetsch(a)discussions.microsoft.com> wrote in message
> news:D46D06CE-254A-4C25-8085-FC91006D275D(a)microsoft.com...
> > In my Word 2007 document, I have a text form with Type equal to 'Date'.
> > Is
> > there a way I can set the default date to be the current date? (I don't
> > want
> > to set the Type to 'Current date' because then the user can't change it.)
> > Thanks!
> >
> > Mary Fetsch
>
>
>
>
> .
>
From: Stefan Blom on
I'm glad I could help.

--
Stefan Blom
Microsoft Word MVP



"Mary Fetsch" <MaryFetsch(a)discussions.microsoft.com> wrote in message
news:047BB396-3676-4D81-A175-A5BE4747A683(a)microsoft.com...
> Thanks so much!
>
> "Stefan Blom" wrote:
>
>> This could be done with an "Entry" macro assigned to the form field in
>> question. What follows is a simple version of such a macro:
>>
>> Sub TestMacro()
>> If Trim$(ActiveDocument.FormFields("Text1") _
>> ..Result) = "" Then
>> ActiveDocument.FormFields("Text1") _
>> ..Result = Format$(Now(), "MMMM DD, YYYY")
>> End If
>> End Sub
>>
>> It is assumed that the bookmark name specified for the field is "Text1"
>> (which is the default). If you have chosen a different name, you should
>> of
>> course use that one instead.
>>
>> --
>> Stefan Blom
>> Microsoft Word MVP
>>
>>
>>
>> "Mary Fetsch" <MaryFetsch(a)discussions.microsoft.com> wrote in message
>> news:D46D06CE-254A-4C25-8085-FC91006D275D(a)microsoft.com...
>> > In my Word 2007 document, I have a text form with Type equal to 'Date'.
>> > Is
>> > there a way I can set the default date to be the current date? (I
>> > don't
>> > want
>> > to set the Type to 'Current date' because then the user can't change
>> > it.)
>> > Thanks!
>> >
>> > Mary Fetsch
>>
>>
>>
>>
>> .
>>