Guest User

Untitled

a guest
Dec 12th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. Sub UpdateDocument()
  2. Dim oStory As Range
  3. Dim oTOC As TableOfContents
  4. Dim oTOF As TableOfFigures
  5. For Each oStory In ActiveDocument.StoryRanges
  6. oStory.Fields.Update
  7. If oStory.StoryType wdMainTextStory Then
  8. While Not (oStory.NextStoryRange Is Nothing)
  9. Set oStory = oStory.NextStoryRange
  10. oStory.Fields.Update
  11. Wend
  12. End If
  13. Next oStory
  14. For Each oTOC In ActiveDocument.TablesOfContents
  15. oTOC.Update
  16. Next oTOC
  17. For Each oTOF In ActiveDocument.TablesOfFigures
  18. oTOF.Update
  19. Next oTOF
  20. ActiveDocument.Save
  21. End Sub
Add Comment
Please, Sign In to add comment