Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Updating a date field
I have created a file that contains a date field. I use this file all of
the time. I created a macro that inserts this file and when the file is inserted, I have to manually update the filed by highlighting the field and pressing the F9 key. This date field code should update itself automatically, and it does if I open the original file, but does not when it's inserted into another file, via a macro that I created. I thought I could edit the macro to automatically update the field, but that doesn't work either. Anyone know how this can be corrected? |
#2
|
|||
|
|||
On Thu, 24 Feb 2005 09:47:03 -0800, "LDHardy"
wrote: I have created a file that contains a date field. I use this file all of the time. I created a macro that inserts this file and when the file is inserted, I have to manually update the filed by highlighting the field and pressing the F9 key. This date field code should update itself automatically, and it does if I open the original file, but does not when it's inserted into another file, via a macro that I created. I thought I could edit the macro to automatically update the field, but that doesn't work either. Anyone know how this can be corrected? Exactly how did you try to get the macro to update the field, and where in the document is the field? If you used ActiveDocument.Fields.Update, that will update only the fields in the "main story" of the document, not those in headers, footers, text boxes, or autoshapes. To get everything, you need code like this: Dim myStoryRange As Range For Each myStoryRange In ActiveDocument.StoryRanges myStoryRange.Fields.Update Do While Not (myStoryRange.NextStoryRange Is Nothing) Set myStoryRange = myStoryRange.NextStoryRange myStoryRange.Fields.Update Loop Next myStoryRange -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#3
|
|||
|
|||
Why are you inserting this into another file using a macro? Have you
considered using AutoText instead? See http://addbalance.com/word/datefields1.htm for information on the different kinds of datefields and how to format them. -- Charles Kenyon Word New User FAQ & Web Directory: http://addbalance.com/word Intermediate User's Guide to Microsoft Word (supplemented version of Microsoft's Legal Users' Guide) http://addbalance.com/usersguide See also the MVP FAQ: http://www.mvps.org/word which is awesome! --------- --------- --------- --------- --------- --------- This message is posted to a newsgroup. Please post replies and questions to the newsgroup so that others can learn from my ignorance and your wisdom. "LDHardy" wrote in message ... I have created a file that contains a date field. I use this file all of the time. I created a macro that inserts this file and when the file is inserted, I have to manually update the filed by highlighting the field and pressing the F9 key. This date field code should update itself automatically, and it does if I open the original file, but does not when it's inserted into another file, via a macro that I created. I thought I could edit the macro to automatically update the field, but that doesn't work either. Anyone know how this can be corrected? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date Field in Merge Document | Mailmerge | |||
How do I stop the DATE field from automatically updating each tim. | Microsoft Word Help | |||
Form Field - Type Date | Microsoft Word Help | |||
inserting a date field for a future date | Microsoft Word Help | |||
Date issue merging from Excel field in Date format to Word | Mailmerge |