A CreateDate field displays the date the document (or template) was created.
A new document created from a template containing a CreateDate field will
display the date the new document was created. It seems that you want some
other date. You cannot change the date in a createdate field, without
eliminating the field or it will simply update to reflect the creation date.
If you want to insert a date a week earlier than the creation date using
fields, then it can get quite complicated, though the work has been done for
you - see
http://www.gmayor.com/insert_a_date_other_than_today.htm and the
linked item you can download from
http://www.gmayor.com/downloads.htm#Third_party
An alternative is to select a date from a calendar and add it to a document
variable using a macro. The macro can be run again should you need to change
the date. Docvariables may be inserted in a document using docvariable
fields - in this example { Docvariable varDate }- in place of the createdate
fields.
The macro used the
http://www.gmayor.com/popup_calendar.htm information with
the following associated code in place of that shown in the article
Private Sub Calendar1_Click()
Dim oVars As Variables
Dim vVar As Variant
Dim oStory As Range
Set oVars = ActiveDocument.Variables
oVars("varDate").Value = Format(Calendar1.Value, "dd mmmm yyyy")
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
Unload Me
End Sub
Private Sub CmdClose_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Calendar1.Value = Date
End Sub
The calendar itself would be called by an autonew macro in the document
template which runs when you create a new document
Sub InsCalendar()
frmCalendar.Show
End Sub
Sub AutoNew()
InsCalendar
End Sub
I have used two macros as you may wish to add extra code to the autonew
macro - see
http://www.gmayor.com/installing_macro.htm while still being
able to run the InsCalendar macro to change the date as required, without
that extra code.
With the docvariable fields in the template, when you create a new document
from that template, the macro pops up the calendar. You select the date that
you want in the document and the macro inserts it into the docvariable field
then updates the fields in the document. If you want a different date format
in each field you could add a date formatting switch to one or both
docvariable fields.
While this may look complicated, it is quicker to set up than explain and
once done is a lot less work than what you are doing at present.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>