A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date field only update if document has been updated



 
 
Thread Tools Display Modes
  #1  
Old April 15th, 2010, 05:17 PM posted to microsoft.public.word.newusers
Kim W. via OfficeKB.com
external usenet poster
 
Posts: 1
Default Date field only update if document has been updated

Ok, this may be simple... but I haven't figured it out yet. I only want the
date/time field in my footer to update if a change to the document has been
made. I don't want it to change when the document opens. I don't want it to
change when it's printed. I don't need the createdate field... that doesn't
work... so.. is there anything I can do?

Thanks!

Kim

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/201004/1

  #2  
Old April 15th, 2010, 05:24 PM posted to microsoft.public.word.newusers
Terry Farrell
external usenet poster
 
Posts: 3,004
Default Date field only update if document has been updated

Use the SaveDate field then.

--
Terry Farrell - MSWord MVP

"Kim W. via OfficeKB.com" u40534@uwe wrote in message
news:a69315050824e@uwe...
Ok, this may be simple... but I haven't figured it out yet. I only want
the
date/time field in my footer to update if a change to the document has
been
made. I don't want it to change when the document opens. I don't want it
to
change when it's printed. I don't need the createdate field... that
doesn't
work... so.. is there anything I can do?

Thanks!

Kim

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/201004/1

  #3  
Old April 16th, 2010, 06:08 AM posted to microsoft.public.word.newusers
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Date field only update if document has been updated

You could use the savedate field. However most fields do not update
automatically and if you updated the savedate field after saving to display
its revised content, the document would need to be saved again ad infinitum.
It should however show the correct date the next time the document is
opened.

You could work around this with a couple of macros in the document template,
then replace the field in the document with the docvariable field {
DocVariable varSaveDate }. The macros update a document variable with the
current date before saving. You can change the date formatting switches
"dd/MM/yyyy" to suit your local preference.

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

Sub FileSave()
Dim oVars As Variables
Dim oField As Field
Set oVars = ActiveDocument.Variables
oVars("varSaveDate").Value = Format(Date, "dd/MM/yyyy")
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldDocVariable Then
oField.Update
End If
Next oField
On Error Resume Next
ActiveDocument.Save
ActiveWindow.Caption = ActiveDocument.FullName
End Sub

and

Sub FileSaveAs()
Dim oVars As Variables
Dim oField As Field
Set oVars = ActiveDocument.Variables
oVars("varSaveDate").Value = Format(Date, "dd/MM/yyyy")
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldDocVariable Then
oField.Update
End If
Next oField
On Error Resume Next
Dialogs(wdDialogFileSaveAs).Show
ActiveWindow.Caption = ActiveDocument.FullName
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



"Kim W. via OfficeKB.com" u40534@uwe wrote in message
news:a69315050824e@uwe...
Ok, this may be simple... but I haven't figured it out yet. I only want
the
date/time field in my footer to update if a change to the document has
been
made. I don't want it to change when the document opens. I don't want it
to
change when it's printed. I don't need the createdate field... that
doesn't
work... so.. is there anything I can do?

Thanks!

Kim

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...neral/201004/1



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.