A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Text Form Date



 
 
Thread Tools Display Modes
  #1  
Old February 24th, 2010, 05:56 PM posted to microsoft.public.word.docmanagement
Mary Fetsch
external usenet poster
 
Posts: 68
Default Text Form Date

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
  #2  
Old February 24th, 2010, 07:00 PM posted to microsoft.public.word.docmanagement
Stefan Blom[_3_]
external usenet poster
 
Posts: 4,556
Default Text Form Date

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" wrote in message
news
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





  #3  
Old February 25th, 2010, 02:44 PM posted to microsoft.public.word.docmanagement
Mary Fetsch
external usenet poster
 
Posts: 68
Default Text Form Date

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" wrote in message
news
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





.

  #4  
Old February 25th, 2010, 02:55 PM posted to microsoft.public.word.docmanagement
Stefan Blom[_3_]
external usenet poster
 
Posts: 4,556
Default Text Form Date

I'm glad I could help.

--
Stefan Blom
Microsoft Word MVP



"Mary Fetsch" wrote in message
...
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" wrote in message
news
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





.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.