Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2020, 01:26 AM
Ryhne Ryhne is offline Update all fields won't update index! Windows 10 Update all fields won't update index! Office 2013
Novice
Update all fields won't update index!
 
Join Date: Apr 2020
Posts: 11
Ryhne is on a distinguished road
Default Update all fields won't update index!

I used the website below to create a shortcut button and update all fields in my document but it won't update the index!



how can I include index in the macro code?

Installing Macros
Reply With Quote
  #2  
Old 04-23-2020, 02:02 AM
macropod's Avatar
macropod macropod is online now Update all fields won't update index! Windows 7 64bit Update all fields won't update index! Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The Fields.Update method doesn't update everything; page #s yes, but TOC entries, etc., no. A simpler, yet more comprehensive, macro is:
Code:
Sub UpdateFields()
Application.ScreenUpdating = False
With ActiveDocument
  .Fields.Update
  .PrintPreview
  .ClosePrintPreview
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-23-2020, 03:06 AM
Ryhne Ryhne is offline Update all fields won't update index! Windows 10 Update all fields won't update index! Office 2013
Novice
Update all fields won't update index!
 
Join Date: Apr 2020
Posts: 11
Ryhne is on a distinguished road
Default

I tried your code. it works for the fields but not for my table of content.
Reply With Quote
  #4  
Old 04-23-2020, 03:11 AM
macropod's Avatar
macropod macropod is online now Update all fields won't update index! Windows 7 64bit Update all fields won't update index! Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

OK, try:
Code:
Sub RefreshFields()
Application.ScreenUpdating = False
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 Rng As Range              ' Range Object
Dim Idx As Index              ' Index Object
With ActiveDocument
  ' Loop through Story Ranges and update.
  ' Note that this may trigger interactive fields (eg ASK and FILLIN).
  For Each Rng In .StoryRanges
    Do
      Rng.Fields.Update
      Set Rng = Rng.NextStoryRange
    Loop Until Rng Is Nothing
  Next
  ' Loop through Tables Of Contents and update
  For Each TOC In .TablesOfContents
    TOC.Update
  Next
  ' Loop through Tables Of Authorities and update
  For Each TOA In .TablesOfAuthorities
    TOA.Update
  Next
  ' Loop through Tables Of Figures and update
  For Each TOF In .TablesOfFigures
    TOF.Update
  Next
  ' Loop through Indices and update
  For Each Idx In .Indexes
    Idx.Update
  Next
  .PrintPreview
  .ClosePrintPreview
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 04-23-2020, 04:49 AM
Ryhne Ryhne is offline Update all fields won't update index! Windows 10 Update all fields won't update index! Office 2013
Novice
Update all fields won't update index!
 
Join Date: Apr 2020
Posts: 11
Ryhne is on a distinguished road
Default

It works perfectly! Thanks
Reply With Quote
Reply

Tags
index, table of content, update field



Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Styleref Fields datech-hh Word VBA 18 11-04-2017 01:35 PM
Update all fields won't update index! Keep Loosing Index Update Capability Phil H Word 1 11-18-2014 04:06 PM
how to update calculated fields sectionbreak Mail Merge 4 06-04-2014 12:12 AM
VBA to update certain (but not all) fields sparkyrose Word VBA 0 05-20-2010 12:50 PM
Can no longer update fields! slindsay Word 0 09-03-2009 05:10 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft