Printing modified CreateDate field in header reverts back - Word 2

S

susiew32

i create a new document. I insert a CreateDate field in the document. Then
I create a header, and insert another CreateDate field there. I save the
document as a template.

I open a new document based on that template. I modify the date in the
document (not deleting the whole field but just changing the day from today
to last week).
Then I go to the header and change that date in the same way.

When I go to Print Preview, the date in the main document stays as I typed
it, but the date in the header reverts to the create date (today).

Does anyone know why that happens? And how I can make the field in the
header act like the field in the body of the document?

Thanks in advance.
 
S

Suzanne S. Barnhill

If you want a date other than the CreateDate for the document, then you will
need to replace the field with plain text. Fields in the header will update
automatically when you print or switch to Print Preview even if you have the
option to update fields on printing disabled.

More to the point, why are you putting the CreateDate field in the template
if you don't want a CreateDate field in the document?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
G

Graham Mayor

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

susiew32

The template is used by many people, and the createdate is what we want in
there. For some reason, one person wanted to change the date. We were just
surprised that the date in the main body of the document behaved differently
than the date in the header.

I will just make sure that she replaces the entire field with the date as
text.

Thanks for all your quick replies, this forum has been and continues to be a
great help to me.
 

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