Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-12-2012, 09:27 PM
ubns ubns is offline Date Fields Windows 7 32bit Date Fields Office 2010 32bit
Competent Performer
Date Fields
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default Date Fields

The word template we are using - has some date fields. I want a macro or a way by which i can change the date field to that particular date.

for example i am working on the doucment today - date field will bring iun todays date. I want to keep that date, however want to stop keep changing the date when i open it next time --- lets tomorrow.



any way of doing this.
Reply With Quote
  #2  
Old 04-13-2012, 03:00 AM
macropod's Avatar
macropod macropod is offline Date Fields Windows 7 64bit Date Fields Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Depending on what you want to achieve, you could use a SAVEDATE, PRINTDATE or CREATEDATE field instead of the DATE field. You can also lock a field via Ctrl-F11 (Ctrl-Shift-F11 to unlock) or convert it to plain text via Ctrl-Shift-F9.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-13-2012, 06:32 AM
Charles Kenyon Charles Kenyon is offline Date Fields Windows Vista Date Fields Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by ubns View Post
The word template we are using - has some date fields. I want a macro or a way by which i can change the date field to that particular date.

for example i am working on the doucment today - date field will bring iun todays date. I want to keep that date, however want to stop keep changing the date when i open it next time --- lets tomorrow.

any way of doing this.
See Using Date Fields in Microsoft Word for an overview of the various date fields available and how to use them.

Note, any time you want to freeze a date (or other) field you can right-click on it and lock it on unlink it. Locking is reversible, unlinking is not.
Reply With Quote
  #4  
Old 05-13-2012, 04:24 PM
ubns ubns is offline Date Fields Windows 7 32bit Date Fields Office 2010 32bit
Competent Performer
Date Fields
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

is it possible to have a macro to lock the date (as there are few date fields) and sometimes i forget to lock one or two.
Reply With Quote
  #5  
Old 05-13-2012, 05:30 PM
macropod's Avatar
macropod macropod is offline Date Fields Windows 7 64bit Date Fields Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi umesh,

Generally speaking, you shouldn't need to lock the fields - you just need to use the right field for the job. For example, if you use the CREATEDATE field, the only time it will update is if you re-save the document using Save As. Similarly, the PRINTDATE field updates every time the document is printed and the SAVEDATE field updates every time the document is saved. The only field that updates every time the document is opened is the plain DATE field.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 05-13-2012, 05:58 PM
ubns ubns is offline Date Fields Windows 7 32bit Date Fields Office 2010 32bit
Competent Performer
Date Fields
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Hi Paul,

Thanks for your reply. The template (in word doc) is created from some other system which we have no control of.

So if i have to change the date fields, i have to change to create that to change it one by one (unless there is macro for that).

or

I can just lock the date field using a macro if possible.

Regards

Umesh Banga
Reply With Quote
  #7  
Old 05-13-2012, 06:36 PM
macropod's Avatar
macropod macropod is offline Date Fields Windows 7 64bit Date Fields Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi umesh,

The following macro will lock all DATE fields in the document.
Code:
Sub LockDates()
Dim Fld As Field, Rng As Range
For Each Rng In ActiveDocument.StoryRanges
  For Each Fld In Rng.Fields
    If Fld.Type = wdFieldDate Then Fld.Locked = True
  Next
Next
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 05-15-2012, 11:17 PM
ubns ubns is offline Date Fields Windows 7 32bit Date Fields Office 2010 32bit
Competent Performer
Date Fields
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Hi Paul,

It work wonders, however it also disables the field for table of contents fields?

anyway to over come this issue?
Reply With Quote
  #9  
Old 05-15-2012, 11:20 PM
macropod's Avatar
macropod macropod is offline Date Fields Windows 7 64bit Date Fields Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Hi umesh,
Quote:
it also disables the field for table of contents fields
I doubt it - the code specifically tests whether the field is a DATE field before applying the lock. You can see it quite clearly in this line:
If Fld.Type = wdFieldDate Then Fld.Locked = True
I suspect you locked the TOC by some other means.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2010 - DOCX File with fields -> PDF with fields senglory Word 2 03-27-2012 10:10 AM
Date Fields Meaning of current date vs status date when saving baselines ketanco Project 1 02-08-2012 02:20 PM
30+ days Variable Day Date Calculations via Fields ztag Word 2 01-06-2012 11:12 AM
new appointment date always reverts back to today's date msills Outlook 0 08-24-2007 08:57 AM
Date Fields Imported message date change to today's date promark Outlook 1 12-23-2005 07:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:16 AM.


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