Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Aug 2003
    Location
    amsterdam, Netherlands
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    macro to update ALL fields (word 2000)

    )Edited by HansV to provide link to post - see <!help=19>Help 19<!/help>)

    Hi All,

    I have Question about updating word fields.
    I was browsing through the earlier postings to find a solution for updating of my field in word doc template
    and found a posting form HANSV about updating REF fields in a footer

    <post#=355606>post 355606</post#> 21 march 2004

    The answer was little macro to update the footer.
    Basically I am looking for something similar, but Then a macro that updates ALL the fields in the form

    I have a form template that is protected and that has REFfields in Textboxes and in the footer.
    the only way now to update them is through printpreview.
    i am looking for the command in VBA to update ALL the fields in the doc like printpreview does
    so that I can create a little macro to do this.

    Thanks in advance,

    greetings,

    Diederik

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: macro to update ALL fields (word 2000)

    This macro is from Microsoft:

    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

    See WD2000: How to Update Fields in a Protected Form.

  3. #3
    Lounger
    Join Date
    Aug 2003
    Location
    amsterdam, Netherlands
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: macro to update ALL fields (word 2000)

    Hi hans,

    Great!

    Thx for the quick reply. [img]/forums/images/smilies/smile.gif[/img]

    Greetings,

    Diederik

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: macro to update ALL fields (word 2000)

    If you want a macro that will update fields that are in text boxes also, see <post#=294288>post 294288</post#> by Bryon Carbonnell.
    Cheers,

  5. #5
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: macro to update ALL fields (word 2000)

    I found that you can replace the second For Each loop with:

    aStory.Fields.Update

    But I don't use any of the field types mentioned as an exception in the article you referenced, so I don't know if they are updated by this line of code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •