"Current date" field: how to stop updating for all Worddocuments?

G

Guest

In MS Word, I sometimes open old invoice documents to print and then present
them to customers who request an invoice copy. My problem is that the date on
the form is a field set to update automatically. I want the date that the
invoice was made to be reflected on the invoice, not the current date. Is it
possible to turn this date field auto-update feature off shortly before I
open the old invoice document to print it? Thank you.
 
J

Jay Freedman

In MS Word, I sometimes open old invoice documents to print and then present
them to customers who request an invoice copy. My problem is that the date on
the form is a field set to update automatically. I want the date that the
invoice was made to be reflected on the invoice, not the current date. Is it
possible to turn this date field auto-update feature off shortly before I
open the old invoice document to print it? Thank you.

Change the Date field to a CreateDate field (details about the
difference are at
http://www.word.mvps.org/FAQs/TblsFldsFms/DateFields.htm).

Right-click the date and choose Toggle Field Codes. You'll see a field
code that starts with either DATE or TIME. Change that word to
CREATEDATE. Then right-click it and choose Update Field. This will
still show the date the document was created, even on old documents
after the date field has updated.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
W

Wayne

Thanks Jay. This works fine but is there a way to turn off the automatic
updating for all word files?
 
M

macropod

Hi Wayne,

You can do this if you go into Tools|OptionsGeneral and uncheck 'Update automatic links at open' and Tools|Options|Print and uncheck
'Update fields'.

Alternatively, you can lock fields individually or collectively via Ctrl-F11 and unlock them by Ctrl-Shift-F11. You can also convert
fields to plain text individually or collectively via Ctrl-Shift-F9
 
W

Wayne

Hi Macropod,

I"m in word2007 and the print option doesn't seem to be there. I have
unchecked the update field in options.
Thanks

macropod said:
Hi Wayne,

You can do this if you go into Tools|OptionsGeneral and uncheck 'Update automatic links at open' and Tools|Options|Print and uncheck
'Update fields'.

Alternatively, you can lock fields individually or collectively via Ctrl-F11 and unlock them by Ctrl-Shift-F11. You can also convert
fields to plain text individually or collectively via Ctrl-Shift-F9

--
Cheers
macropod
[MVP - Microsoft Word]


Wayne said:
Thanks Jay. This works fine but is there a way to turn off the automatic
updating for all word files?
 
G

Graham Mayor

The following macro will replace all the date fields in documents in a
folder with createdate fields. Change it in the template for new documents.

Sub BatchFixDates()
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document
Dim iFld As Integer
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog
.Title = "Select Folder containing the documents to be modifed and click
OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
PathToUse = fDialog.SelectedItems.Item(1)
If Right(PathToUse, 1) <> "\" Then PathToUse = PathToUse + "\"
End With

If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
myFile = Dir$(PathToUse & "*.do?")

While myFile <> ""
Set myDoc = Documents.Open(PathToUse & myFile)
ActiveWindow.View.ShowFieldCodes = True
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
If .Type = wdFieldDate Then
.Code.Text = Replace(.Code.Text, "DATE", "CREATEDATE")
.Update
End If
End With
Next iFld
ActiveWindow.View.ShowFieldCodes = False
myDoc.Close SaveChanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub

http://www.gmayor.com/installing_macro.htm


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

My web site www.gmayor.com

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

Graham Mayor

On further reflection, if the fields have been entered manually they may not
be in upper case and therefore the macro will ignore them, so change the
lines

If .Type = wdFieldDate Then
.Code.Text = Replace(.Code.Text, "DATE", "CREATEDATE")
.Update
End If


to
If .Type = wdFieldDate Then
.Code.Text = Replace(UCase(.Code.Text), "DATE", "CREATEDATE")
.Update
End If
If .Type = wdFieldTime Then
.Code.Text = Replace(UCase(.Code.Text), "TIME", "CREATEDATE")
.Update
End If

which should cover all eventualities.

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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