• macro to update ALL fields (word 2000)

    Author
    Topic
    #405241

    )Edited by HansV to provide link to post – see Help 19)

    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 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

    Viewing 0 reply threads
    Author
    Replies
    • #830552

      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.

      • #830557

        Hi hans,

        Great!

        Thx for the quick reply.

        Greetings,

        Diederik

      • #830558

        Hi hans,

        Great!

        Thx for the quick reply.

        Greetings,

        Diederik

      • #833302

        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.

      • #833303

        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.

    Viewing 0 reply threads
    Reply To: macro to update ALL fields (word 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: