![]() |
|
#1
|
|||
|
|||
![]()
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. |
#2
|
||||
|
||||
![]()
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] |
#3
|
|||
|
|||
![]() Quote:
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. |
#4
|
|||
|
|||
![]()
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.
|
#5
|
||||
|
||||
![]()
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] |
#6
|
|||
|
|||
![]()
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 |
#7
|
||||
|
||||
![]()
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] |
#8
|
|||
|
|||
![]()
Hi Paul,
It work wonders, however it also disables the field for table of contents fields? anyway to over come this issue? |
#9
|
||||
|
||||
![]()
Hi umesh,
Quote:
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] |
![]() |
|
![]() |
||||
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 |
![]() |
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 |
![]() |
promark | Outlook | 1 | 12-23-2005 07:21 AM |