Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Aug 2011
    Posts
    112
    Thanks
    35
    Thanked 3 Times in 3 Posts

    Update TOC and SEQ fields upon close or before save

    This seems to be elusive as in the VBA there isn't a declarations for before save or before close.

    I've inserted Quick Parts >> Fields for some table sequencing and one for total number of pages. I also have a table of contents.

    I would like to have those fields auto updated when the user closes and/or saves the file.

    Using the macro recorder I came up with...

    Code:
    Sub Macro3()
        Application.ScreenUpdating = False
        Selection.WholeStory
        With ActiveDocument
            .Fields.Update
        End With
        Application.ScreenUpdating = True
    End Sub
    Two questions, how can this happen on close and/or save and how can the TOC be suppressed to not ask for update entire table?

  2. #2
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Quote Originally Posted by jrb View Post
    This seems to be elusive as in the VBA there isn't a declarations for before save or before close.
    Word does indeed have DocumentBeforeClose and DocumentBeforeSave events that you can use, if they meet your needs. See: http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  3. The Following User Says Thank You to macropod For This Useful Post:

    jrb (2016-04-17)

Posting Permissions

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