Results 1 to 9 of 9
  1. #1
    New Lounger
    Join Date
    Sep 2003
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    TOC UPDATE DEFAULT (2000)

    Greetings,

    I want to change the default setting for the small pop up window that appears when I use F9 to update my TOC.

    It appears with 2 choices - 1) update page numbers only and 2) update everything (so to speak!)

    The "update page numbers" is selected by default. How can I change that to the "update everything" choice?

    I know nothing about VBA so if that's the solution, please provide step-by-step instrucs!

    Thanks!

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: TOC UPDATE DEFAULT (2000)

    Well... F9 means Update Field. If we create a special behavior for F9 that doesn't make sense for other kinds of fields, we might create more trouble than we fix. <img src=/S/grin.gif border=0 alt=grin width=15 height=15> I actually don't know if there is a way to force this update to be "silent." Hmmm...

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

    Re: TOC UPDATE DEFAULT (2000)

    You could simply use a macro & assign F9 to it. Bryan Carbonnell wrote a macro that goes through every part of a document (headers, body, comments) & updates the fields. Since the search engine is down, I could post it, if that's what you want to do. Or you could assign some other hotkey to it--otherwise you wouldn't be able to update just individual fields using F9.

    Oh, for what it's worth, I update a TOC by F9, down arrow, <enter>. Almost as fast.

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TOC UPDATE DEFAULT (2000)

    Here is the macro Phil was talking about.
    <pre>Public Sub UpdateAllFields()
    '---------------------------------------------------------------------------------------
    ' Procedure: sUpdateFields (V2)
    ' DateTime : 20-Dec-2001
    ' Updated : 06-Nov-2002 - Update fields in Text Boxes
    ' Author : Bryan Carbonnell
    ' With code by Nancy Hutson Hale
    ' Purpose : To update all fields in the Word Document including TOC, TOA, TOF,
    ' fields in text boxes and fields in headers/footers
    '---------------------------------------------------------------------------------------

    Dim doc As Document ' Pointer to Active Document
    Dim wnd As Window ' Pointer to Document's Window
    Dim lngMain As Long ' Main Pane Type Holder
    Dim lngSplit As Long ' Split Type Holder
    Dim lngActPane As Long ' ActivePane Number
    Dim rngStory As Range ' Range Object for Looping through Stories
    Dim TOC As TableOfContents ' Table of Contents Object
    Dim TOA As TableOfAuthorities 'Table of Authorities Object
    Dim TOF As TableOfFigures 'Table of Figures Object
    Dim shp As Shape 'Shape Object to get Textboxes

    ' Set Objects
    Set doc = ActiveDocument
    Set wnd = ActiveDocument.ActiveWindow

    ' get Active Pane Number
    lngActPane = wnd.ActivePane.Index

    ' Hold View Type of Main pane
    lngMain = wnd.Panes(1).View.Type

    ' Hold SplitSpecial
    lngSplit = wnd.View.SplitSpecial

    ' Get Rid of any split
    wnd.View.SplitSpecial = wdPaneNone

    ' Set View to Normal
    wnd.View.Type = wdNormalView

    ' Loop through each story in doc to update
    For Each rngStory In doc.StoryRanges
    If rngStory.StoryType = wdCommentsStory Then
    Application.DisplayAlerts = wdAlertsNone
    ' Update fields
    rngStory.Fields.Update
    Application.DisplayAlerts = wdAlertsAll
    Else
    ' Update fields
    rngStory.Fields.Update
    End If
    Next

    'Loop through text boxes and update
    ' added by Nancy Hutson Hale - Nov 6, 2002
    For Each shp In doc.Shapes
    With shp.TextFrame
    If .HasText Then
    .TextRange.Fields.Update
    End If
    End With
    Next

    ' Loop through TOC and update
    For Each TOC In doc.TablesOfContents
    TOC.Update
    Next

    ' Loop through TOA and update
    For Each TOA In doc.TablesOfAuthorities
    TOA.Update
    Next

    ' Loop through TOF and update
    For Each TOF In doc.TablesOfFigures
    TOF.Update
    Next

    ' Return Split to original state
    wnd.View.SplitSpecial = lngSplit

    ' Return main pane to original state
    wnd.Panes(1).View.Type = lngMain

    ' Active proper pane
    wnd.Panes(lngActPane).Activate

    ' Close and release all pointers
    Set wnd = Nothing
    Set doc = Nothing

    End Sub</pre>


    Most anything major I have written is available on my website, which is in my sig.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: TOC UPDATE DEFAULT (2000)

    Brian,

    Have you checked that this code updates all headers and footers in multisection documents? I think it will only get the headers and footers for the first section and that you need to loop round the Sections collection to update them all.

    StuartR

  6. #6
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TOC UPDATE DEFAULT (2000)

    It has been pretty thuroughly tested by quite a few folks.

    IIRC, this section of the code updates all the headers and footers, even in different sections is:

    <pre>' Loop through each story in doc to update
    For Each rngStory In doc.StoryRanges
    If rngStory.StoryType = wdCommentsStory Then
    Application.DisplayAlerts = wdAlertsNone
    ' Update fields
    rngStory.Fields.Update
    Application.DisplayAlerts = wdAlertsAll
    Else
    ' Update fields
    rngStory.Fields.Update
    End If
    Next</pre>


    I just did a quick test and it does update all the headers/footers of multi section docs.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

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

    Re: TOC UPDATE DEFAULT (2000)

    Hi Stuart:
    I tested the macro in a 3 section document & it updated both the body & the separate headers in all 3 sections. (Of course, I don't know why though <img src=/S/smile.gif border=0 alt=smile width=15 height=15>)

  8. #8
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: TOC UPDATE DEFAULT (2000)

    Thanks for the education. Next time I'll test first and post second.

    StuartR

  9. #9
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: TOC UPDATE DEFAULT (2000)

    Hey no worries Stuart. We've all done it before <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

Posting Permissions

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