#1
|
|||
|
|||
Updating Cross refs
I am using msw 16. I have a file that contains a table. The first column of the table is a numbered list. There are other columns in the table that show cross refs to the first column in several other rows. I have now sorted the table on columns other than the first. This redoes the first column starting with 1 again which is fine. The cross refs still show the original numbers but they are highlighted so they can be updated.
As this a fairly large table updating the individual cross refs is very time consuming. Is there a way to globally update these fields? Thanks for any and all help. |
#2
|
||||
|
||||
Does selecting the whole table and pressing F9 achieve what you want? If not, we'll need a better explanation of what you've referenced, how the referencing was done and how they should be updated.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Otherwise, the following macro will update all cross-references in a document, but may be overkill.
Code:
Sub UpdateAllRef() ' Update all Ref fields in a document, even if in headers/footers or textboxes ' https://gregmaxey.com/word_tip_pages/word_fields.html ' November 6, 2018 Charles Kenyon Dim rngStory As Word.range Dim lngValidate As Long ' do not know purpose of this - CK Dim oShp As Shape ' Dim oTOC As TableOfContents, oToa As TableOfAuthorities, oTof As TableOfFigures Dim oStory As range Dim oField As Field lngValidate = ActiveDocument.Sections(1).Headers(1).range.StoryType ' do not know purpose of this For Each rngStory In ActiveDocument.StoryRanges 'Iterate through all linked stories For Each oField In oStory.Fields If oField.Type = wdFieldRef Then oField.Update Next oField Do On Error Resume Next For Each oField In rngStory.Fields If oField.Type = wdFieldRef Then oField.Update Next oField ' 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 For Each oField In oShp.TextFrame.Fields If oField.Type = wdFieldRef Then oField.Update Next oField ' 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 ' Set oStory = Nothing Set oField = Nothing Set rngStory = Nothing Set oShp = Nothing ' Set oTOC = Nothing ' Set oToa = Nothing ' Set oTof = Nothing End Sub |
#4
|
||||
|
||||
You can trigger an update of cross-reference fields by switching to print preview (File | Print) and then return to Print Layout view (for example by pressing ESC).
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
cross-refs: navigate from target back to source | eNGiNe | Word | 1 | 03-03-2015 12:51 PM |
Help with set up of automatically updating cross reference. | lukebrown | Word VBA | 5 | 09-11-2013 09:38 AM |
Cross references not updating correctly | CLWriter | Word | 4 | 04-03-2012 07:23 AM |
cross-referencing - lock/unlock updating | minszki | Word | 1 | 03-11-2012 11:28 AM |
Mass Update of Cross-Refs MS2010 | judicial85 | Word | 1 | 03-08-2011 10:33 PM |