#1   Report Post  
LDHardy
 
Posts: n/a
Default 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   Report Post  
Jay Freedman
 
Posts: n/a
Default

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   Report Post  
Charles Kenyon
 
Posts: n/a
Default

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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Date Field in Merge Document Karen Hart Mailmerge 35 March 29th 05 12:38 PM
How do I stop the DATE field from automatically updating each tim. Southern Rivers Microsoft Word Help 2 January 25th 05 11:22 PM
Form Field - Type Date webnut Microsoft Word Help 4 January 25th 05 03:48 PM
inserting a date field for a future date rm Microsoft Word Help 2 January 10th 05 07:18 PM
Date issue merging from Excel field in Date format to Word Barb Reinhardt Mailmerge 1 December 17th 04 07:34 AM


All times are GMT +1. The time now is 12:25 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"