FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


MS Word 2002: How to update fields on save? VB Macro?





cambridge
as in the subject.

MS Word does not updates fields automatically. User have to manually update a field, or choose print preview (or print), to see updated fields.

But I need solution which is transparent to user: on every doc save fields have to be updated and shown. Field I use are: RevNum, SaveDate, LastSavedBy. Unfortunately, RevNum is not updated after save.. The solution would be a macro, I suppose.

Can anybody help modify one of the samples I've found (I don't know Visual BAsic..)? I need macro which updates fields on save.

1. (taken from http://gregmaxey.mvps.org/Word_Fields.htm)

'
Code:
Sub UpdateFields()
Dim pRange As Word.Range
For Each pRange In ActiveDocument.StoryRanges
  Do
    pRange.Fields.Update
    Set pRange = pRange.NextStoryRange
  Loop Until pRange Is Nothing
Next
End Sub


2. from http://ask.support.microsoft.com/kb/291474/
Code:
Sub UpdateAllFields()

   Dim aStory As Range
   Dim aField As Field

   For Each aStory In ActiveDocument.StoryRanges
      For Each aField In aStory.Fields
         aField.Update
      Next aField
   Next aStory

End Sub
Related topics
Clean HTML from MS Word, possible?
Any way to downgrade from Word 2007 to Word 2002?
MS Word gives me migraine
What is the best way to learn?
Website Designer?
What Are Viruses
What is "CCAPP.exe"?
Best filemanager?
Tech Support
Windows Tips&tricks!
Open Office
Hhow many of these can people solve?
Microsoft Word Documents & Visual Basics
Open Office
Reply to topic    Frihost Forum Index -> Computers -> Software

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.