Reply
 
Thread Tools Display Modes
  #1   Report Post  
Seagull
 
Posts: n/a
Default How to keep date issued (not created) on protected form?

I have created a protected form as a template, using dropdown fields, etc. I
want the date on which the form is used to fill automatically and remain as
this date, if reopened at a later date.

By using the current date field, the current day's date always appears. By
using the create date field, the date on which the form was created appears.
As the form is protected, I can't update the field.

I think there may be some way to protect, unprotect and insert the date and
reprotect the form? Any suggestions?
  #2   Report Post  
Jay Freedman
 
Posts: n/a
Default

Seagull wrote:
I have created a protected form as a template, using dropdown fields,
etc. I want the date on which the form is used to fill automatically
and remain as this date, if reopened at a later date.

By using the current date field, the current day's date always
appears. By using the create date field, the date on which the form
was created appears. As the form is protected, I can't update the
field.

I think there may be some way to protect, unprotect and insert the
date and reprotect the form? Any suggestions?


You'll need two things: A macro in the template, and a MacroButton field and
a bookmark to launch it.

The macro should look like this (tweak the format string to the date format
you prefer, and add password handling if necessary):

Sub InsertCurrentDate()
Dim oRg As Range

With ActiveDocument
If .ProtectionType wdNoProtection Then
.Unprotect
End If

Set oRg = .Bookmarks("CurrentDate").Range
oRg.Text = Format(Date, "d MMMM yyyy")
.Bookmarks.Add Name:="CurrentDate", Range:=oRg

.Protect Type:=wdAllowOnlyFormFields
End With
End Sub

In the template, place a bookmark named CurrentDate where you want the date
to appear, and next to it place a macrobutton field with a field code like
this:

{ MacroButton InsertCurrentDate Double-click to insert date }

When you create a document based on the template, you can double-click the
macrobutton's text to insert the date at the bookmark. Since it's plain text
rather than a field, the date won't update unless you double-click the
macrobutton again.

As a variation, if you put the macrobutton field inside the bookmark, the
date can only be set once. The inserted text will wipe out the macrobutton
field, so the date becomes permanent.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org


  #3   Report Post  
Nikola
 
Posts: n/a
Default

I tested the script and its works, except that all the other fields are reset
to blanks.

Nikola

"Jay Freedman" wrote:

Seagull wrote:
I have created a protected form as a template, using dropdown fields,
etc. I want the date on which the form is used to fill automatically
and remain as this date, if reopened at a later date.

By using the current date field, the current day's date always
appears. By using the create date field, the date on which the form
was created appears. As the form is protected, I can't update the
field.

I think there may be some way to protect, unprotect and insert the
date and reprotect the form? Any suggestions?


You'll need two things: A macro in the template, and a MacroButton field and
a bookmark to launch it.

The macro should look like this (tweak the format string to the date format
you prefer, and add password handling if necessary):

Sub InsertCurrentDate()
Dim oRg As Range

With ActiveDocument
If .ProtectionType wdNoProtection Then
.Unprotect
End If

Set oRg = .Bookmarks("CurrentDate").Range
oRg.Text = Format(Date, "d MMMM yyyy")
.Bookmarks.Add Name:="CurrentDate", Range:=oRg

.Protect Type:=wdAllowOnlyFormFields
End With
End Sub

In the template, place a bookmark named CurrentDate where you want the date
to appear, and next to it place a macrobutton field with a field code like
this:

{ MacroButton InsertCurrentDate Double-click to insert date }

When you create a document based on the template, you can double-click the
macrobutton's text to insert the date at the bookmark. Since it's plain text
rather than a field, the date won't update unless you double-click the
macrobutton again.

As a variation, if you put the macrobutton field inside the bookmark, the
date can only be set once. The inserted text will wipe out the macrobutton
field, so the date becomes permanent.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove auto date from a word document created using a template Confused Page Layout 3 May 8th 23 08:50 AM
How do I change the created date in a Word document? Formerly Dan Microsoft Word Help 1 April 5th 05 05:02 AM
using date field in merge Henri Vrancken Mailmerge 3 March 5th 05 02:52 PM
Password protected template Jason Reichenbach Microsoft Word Help 0 March 1st 05 03:43 PM
How could Created Date be LATER than Modified Date? Tad Microsoft Word Help 1 February 17th 05 05:12 AM


All times are GMT +1. The time now is 11:01 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"