View Single Post
 
Old 06-15-2016, 02:47 PM
Charles Kenyon Charles Kenyon is online now Windows 8 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,536
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Not really. The thing is that Word puts things in layers or containers.

See the example given by Graham Mayor here: Installing Macros.

I believe that the following is the most thorough macro to do this that I've encountered. It comes from Greg Maxey in this thread.

Code:
Sub UpdateAllFieldsAllStoryMaxey()    ' Greg Maxey
    ' http://answers.microsoft.com/en-us/office/forum/office_2007-word/how-to-update-all-fields-in-a-document-at-once/54b43181-0ea7-4abc-bfb9-e0555125dfe5?page=5
    Dim rngStory As Word.Range
    Dim lngJunk As Long
    Dim oShp As Shape
    Dim oToc As TableOfContents, oToa As TableOfAuthorities, oTof As TableOfFigures
    lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType
    For Each rngStory In ActiveDocument.StoryRanges
      'Iterate through all linked stories
      Do
        On Error Resume Next
        rngStory.Fields.Update
        Select Case rngStory.StoryType
          Case 6, 7, 8, 9, 10, 11
            If rngStory.ShapeRange.Count > 0 Then
              For Each oShp In rngStory.ShapeRange
                If oShp.TextFrame.HasText Then
                   oShp.TextFrame.TextRange.Fields.Update
                End If
              Next
            End If
          Case Else
            'Do Nothing
        End Select
        On Error GoTo 0
        'Get next linked story (if any)
        Set rngStory = rngStory.NextStoryRange
      Loop Until rngStory Is Nothing
      'Special Cases
      For Each oToc In ActiveDocument.TablesOfContents
        oToc.Update
      Next oToc
      For Each oToa In ActiveDocument.TablesOfAuthorities
        oToa.Update
      Next
      For Each oTof In ActiveDocument.TablesOfFigures
        oTof.Update
      Next
    Next
End Sub
-
My experience, though, is that StyleRef fields update instantly when in a header or footer. I believe that this is true when they are in the body of a document as well but am not certain. I do know that they update much better than do REF fields.
Reply With Quote