Sub UpdateDocumentFields

Update all document properties in a given Word document.

Sub UpdateDocumentFields(Doc)
  Dim oStory, oToc
  ' Update alle fields
  For Each oStory In Doc.StoryRanges
      oStory.Fields.Update 'update fields in all stories
  Next oStory

  For Each oToc In Doc.TablesOfContents
      oToc.Update 'update TOC's
  Next oToc

  ' Update header
  Doc.Sections(Doc.Sections.Count).Headers(1).Range.Fields.Update
End Sub