Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2015, 07:06 PM
Macer Macer is offline Updating fields in word on save Windows 7 64bit Updating fields in word on save Office 2007
Novice
Updating fields in word on save
 
Join Date: Jan 2015
Posts: 9
Macer is on a distinguished road
Default Updating fields in word on save

I have been trying to get create a template that they set the date the file was first created, the date it was last modified and the file path. It looks like I need a macro to do this. I have seen some that update all fields but I don't need the created date to be updated every time. I also am not sure what I need to do so that it updates on save. These are all located in the footer. This is all done in Office 2007. Will it make a difference if these are docm or docx files? Thanks for any help I can get.
Reply With Quote
  #2  
Old 01-29-2015, 08:49 PM
macropod's Avatar
macropod macropod is offline Updating fields in word on save Windows 7 64bit Updating fields in word on save Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You don't need a macro for that - all you need do is add a CREATEDATE field to the template. The CREATEDATE field works with doc, docx and docm files.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-31-2015, 08:49 AM
Macer Macer is offline Updating fields in word on save Windows 7 64bit Updating fields in word on save Office 2007
Novice
Updating fields in word on save
 
Join Date: Jan 2015
Posts: 9
Macer is on a distinguished road
Default

Thanks. The date change seems to be working, but the file path is not updating unless done manually.
Reply With Quote
  #4  
Old 01-31-2015, 12:22 PM
macropod's Avatar
macropod macropod is offline Updating fields in word on save Windows 7 64bit Updating fields in word on save Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Are you using a FILENAME field for the file name & path? If so, it should update any time the document is previewed or printed.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-02-2015, 02:22 PM
Macer Macer is offline Updating fields in word on save Windows 7 64bit Updating fields in word on save Office 2007
Novice
Updating fields in word on save
 
Join Date: Jan 2015
Posts: 9
Macer is on a distinguished road
Default

I check with others wanted. It seems it needs to kept up to date not just when printing.
Reply With Quote
  #6  
Old 02-02-2015, 02:27 PM
macropod's Avatar
macropod macropod is offline Updating fields in word on save Windows 7 64bit Updating fields in word on save Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could try a macro like:
Code:
Sub Document_Open()
Application.ScreenUpdating = False
With ActiveDocument
  .Fields.Update
  .PrintPreview
  .ClosePrintPreview
End With
Application.ScreenUpdating = True
End Sub
In the document template's 'ThisDocument' code module.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 02-09-2015, 06:29 AM
Macer Macer is offline Updating fields in word on save Windows 7 64bit Updating fields in word on save Office 2007
Novice
Updating fields in word on save
 
Join Date: Jan 2015
Posts: 9
Macer is on a distinguished road
Default

This runs on open. Is there a way to run it on save? Thanks for the help.
Reply With Quote
  #8  
Old 02-09-2015, 03:06 PM
macropod's Avatar
macropod macropod is offline Updating fields in word on save Windows 7 64bit Updating fields in word on save Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could rename the macro 'FileSave' (and make a copy that's named 'FileSaveAs' - plus adding the necessary code to deploy the 'Save As' dialogue) to intercept Word's FileSave & FileSaveAs events, but more recent Word versions seem to be deprecating those. However, since the Document_Open event achieves much the same result for any document upon opening, I'd have thought that would be sufficient - the only thing it won't automatically update is the filename when a file is first created or re-saved via Save As, but it will capture that too, the next time the document is opened.

Although Word has 'DocumentBeforeSave' and 'DocumentBeforeClose' application events you could use, programming those is rather more complicated than using the built-in Document_Open event. To see what's involved, check out: http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 02-09-2015, 03:31 PM
Macer Macer is offline Updating fields in word on save Windows 7 64bit Updating fields in word on save Office 2007
Novice
Updating fields in word on save
 
Join Date: Jan 2015
Posts: 9
Macer is on a distinguished road
Default

OK thanks. I will try it. Thanks for all of the help.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating fields in word on save locking word table cells while auto-updating fields fingermouse Word 6 01-14-2015 06:22 AM
Create automatically updating fields in Word 2010 tryer Word 8 01-08-2014 12:39 AM
Updating fields in word on save Word auto updating fields and changing numbers when saving to PDF OAEC Word 1 12-03-2013 08:01 PM
Updating fields in word on save Word 2013 Fields not updating awaywithpixie Word 1 09-10-2013 10:35 AM
Auto-updating fields in Word 2007? V.V Ruby Soho Word 2 11-19-2009 04:35 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:12 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft