Setting Dates in Editable Form Fields In a Protected Form

G

Graham Mayor

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_other_than_today.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

Set the field types as date or text - not Current Date. The macro will
insert the current date and the calculated date in the fields indicated in
the section

.FormFields("Text11").Result = sDate
.FormFields("Text14").Result = fDate
 

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