Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

Update all fields on saving/closing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason L - 09 Nov 2004 21:23 GMT
Hey, would anyone be able to pass on the code for updating all fields in a
template when the user closes and/or saves and closes?  

Here is what I have so far:

ActiveDocument.Fields.Update

TIA,
Jason
Helmut Weber - 10 Nov 2004 01:10 GMT
Hi Jason,
you may intercept "filesave" and "filesaveas", like this:
Sub filesave()
Dim rStr As Object
For Each rStr In ActiveDocument.StoryRanges
  rStr.Fields.Update
Next
ActiveDocument.Save
End Sub
---
But there is more to it.
First, updating fields plus closing without saving
doesn't make sense to me. So intercepting documentclose
combined with updating fields would be useless.
Second, updating fields in templates (!) doesn't make
much sense either.
Third, for processing really all (!) kinds of storyranges, see:
http://word.mvps.org/faqs/customization/ReplaceAnywhere.htm
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
Jason L - 10 Nov 2004 14:38 GMT
Thanks for your help, Helmut.

-Jason

> Hi Jason,
> you may intercept "filesave" and "filesaveas", like this:
[quoted text clipped - 20 lines]
> Word XP, Win 98
> http://word.mvps.org/
Jason L - 10 Nov 2004 14:38 GMT
Helmut,

Yeah, not sure why I said that about closing without saving.   That's kinda
silly.

As for updating fields in a template, I really meant documents based on a
template.  Sorry for the poor wording.

-Jason

> Hi Jason,
> you may intercept "filesave" and "filesaveas", like this:
[quoted text clipped - 20 lines]
> Word XP, Win 98
> http://word.mvps.org/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.