View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Setting Dates in Editable Form Fields In a Protected Form

If the field must be editable, you can only do this with macros, which
creates the problem of how you are going to ensure the users will allow the
macros to run. Ideally you should save the form as a template and users
would create new documents from it. In which case you can populate the date
fields from an autonew macro e.g.

Sub Autonew()
Dim sDate As Date
Dim fDate As Date
Dim dDoc As Document
Set dDoc = ActiveDocument
sDate = Format(Date, "dd/MM/yy")
fDate = Format((Date + 30), "dd/MM/yy")
With dDoc
.FormFields("Text1").Result = sDate
.FormFields("Text2").Result = fDate
.FormFields("Text1").Select
End With
End Sub

The macro assumes the two date form fields are bookmarked Text1 and Text2.
See also http://www.gmayor.com/popup_calendar.htm and
http://www.gmayor.com/insert_a_date_...than_today.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Lilbit wrote:
#1) I need a form field to default to the current date, but I want
the user to be able to change it if they want.

#2) I need a form field to default to 30 days from the current date,
but I want the user to be able to change it if they want.

Thanks in advance for your help!!!