Microsoft has awarded Lene Fredborg, DocTools, the Microsoft MVP award for Word each year since 2008. Link to info about the MVP Award at Microsoft.com DocTools - document automation - add-ins, macros and document templates for Microsoft Word (logo) Document Automation
Add-ins & Macros
Document Templates
For Microsoft Word
Document automation, templates, add-ins, macros, for Microsoft Word (graphic)



Bookmark this page | Tip a friend about DocTools


Search thedoctools.com:

Custom Search



Word Tips about...

Cross-references – Troubleshooting

You may sometimes experience that one or more cross-reference fields in a document do not show the correct content. You may experience cross-reference fields that are not updated even if you changed the referenced item, e.g. a heading. The problem may also be that one or more fields refer to section no. 0 or a wrong number. Finally, the problem could be that one or more fields contain a lot of text where you expected a reference to a heading only. This article explains how these errors occur and how to manually repair and prevent them.

The article also introduces you to DocTools CrossReferenceManager – an advanced Word add-in that makes the work with cross-references much faster and easier and that can help you automatically repair and prevent cross-reference problems in the future.

Terms of use

You are welcome to use the macros and Word tips provided on this website. The contents is copyright. You may not reproduce any of contents (with or without modification or credits) elsewhere on the web, or on CD. Please link to the contents on this website instead.

Please note that all free Word tips, macros, add-ins and demos are provided "as is" and without obligation. See also detailed Terms of use.



Go to info about DocTools CrossReferenceManager – advanced Word add-in
Go to info about manual troubleshooting of cross-references


Advanced Word add-in – Cross-references in Word – easier and smarter than ever with DocTools CrossReferenceManager


DocTools CrossReferenceManager - advanced add-in for Word

Free Trial - Try Before You Buy     Word add-in from DocTools

The add-in works with Microsoft Word 2007, 2010, 2013, 2016 on PC.

DocTools CrossReferenceManager lets you do everything you can do using the built-in cross-reference functionality of Word easier and faster. In addition, DocTools CrossReferenceManager includes smart and efficient cross-reference features that are not found elsewhere.

For example, you can save language-specific custom cross-reference texts that contain placeholders for multiple cross-reference fields and insert the text, including all the cross-references, with a single click. See the example below (field shading is turned to to make it easy to identify fields):

Bullet

Among the features are also special tools for detecting and handling cross-reference errors:

BulletThe add-in includes a command that checks the document for errors – such as the cross-reference errors described on this page – and provides tools for repairing any errors found.

BulletIn addition, the add-in includes functionality that can prevent certain types of errors.

You can access the functionality of the add-in from a custom tab in the Ribbon.

How to get the DocTools CrossReferenceManager add-in

This advanced add-in is not free but the return on investment is almost immediate. It will make all your future work with cross-reference faster and easier.

Click the button below to learn more about
DocTools CrossReferenceManager or to buy the add-in.

You can try DocTools CrossReferenceManager risk-free for 15 days.

READ MORE - 15-Day Free Trial



Top of page

Manual troubleshooting of cross-references

Read below if you want to manually find and fix the cross-reference problems instead of letting the DocTools CrossReferenceManager add-in help you:

General tip about working with fields in documents

A cross-reference is a field, i.e. set of codes that instructs Microsoft Word to automatically insert material into a document. The material can be text, page numbers, section numbers, graphics, etc.

Fields can be shown with gray shading on the screen so that it is easy distinguish fields from normal text. Note that field shading does not print. Field shading can be turned on via Tools > Options > View tab. You can select to have field shading shown Never, Always or When selected. See the illustration below.

In case of Microsoft Word 2007, you will find the Field Shading option as follows: Office button > Word Options > Advanced category > Show document content group > Field shading.

In case of Microsoft Word 2010 or later version, you will find the Field Shading option as follows: File > Options > Advanced category > Show document content group > Field shading.

Turn on field shading

I recommend that you always show field shading when working with documents that contain fields.

If you cannot see the fields, you risk to make changes that are lost when you update fields. Setting field shading to Always also makes it much easier to find cross-reference problems, if any.


If you use Microsoft Word 2007 or later version
Note that the demos have been created using Microsoft Word 2003. The demos show the Bookmark dialog box. In Microsoft Word 2007 or later version, you can open the Bookmark dialog box via Insert tab > Links group > Bookmark.

Problem 1 – cross-references are not updated

Situation: You have made changes to one or more headings or other items that are cross-referenced in the document. However, the cross-reference fields still show the old text even if you update all fields.

Cross-reference field that has not been updated correctly

View the demo below for an explanation of how the problem occurs and how you can solve it. The demo also explains what to do in order to prevent such errors. The key to the problem is to be found in the way you edit cross-referenced items.

Problem 2 – cross-references refer to section no. 0

If the problem occurs in relation to a cross-reference to a numbered paragraph in a table, see also Problem 4 below.


Situation: One or more cross-reference fields that should have referred to a heading number (or another numbered item) refer to section no. 0 after updating fields. Alternatively, one or more fields refer to a wrong number after updating fields.

Cross-reference field that refer to section no. 0
Cross-reference field that refer to the wrong number

View the demo below for an explanation of how the problem occurs and how you can solve it. The demo also explains what to do in order to prevent such errors. As for problem 1 described above, the key to the problem is to be found in the way you edit cross-referenced items.

Problem 3 – cross-references contain too much text

Situation: One or more cross-reference fields that should have referred to the text of a heading or another item contain too much text after updating fields. You may even see e.g. tables or pictures included in a cross-reference.

Cross-reference field that contains too much text

View the demo below for an explanation of how the problem occurs and how you can solve it. The demo also explains what to do in order to prevent such errors. As for problems 1 and 2 described above, the key to the problem is to be found in the way you edit cross-referenced items.

Problem 4 – cross-reference to a numbered paragraph in a table refers to number 0 or a wrong number

Situation: You insert a cross-reference to a numbered item in a table. Instead of showing the number you selected, the cross-reference shows 0 or a wrong number after updating fields.

See the two illustrations below. In both illustrations, the cross-references that show 0 and A refer to the yellow 1. and 2. in the table and should have shown 1. and 2. Formatting marks are shown so you can see that the numbered paragraphs in the yellow column/paragraphs contain no text after the number and tab.

Cross-reference fields to numbered items in table cells refer to the wrong numbers

Cross-reference fields to numbered items in table cells refer to the wrong numbers

This problem is caused by a bug in Word that exists in all Word versions at least since Word 2003. The problem occurs if you insert a cross-reference to a paragraph for which the following is true:

  • The numbered paragraph is in a table
  • The paragraph is not the first paragraph in the first cell in the row
  • The paragraph is the last paragraph in the cell
  • The paragraph contains no text except the number

If all rules above apply, Word creates a wrong bookmark for the cross-reference as explained and illustrated below. Notice that the rules apply to the two examples illustrated above. In the first example, the numbered paragraphs are in the second column. In the second example, the numbered paragraphs are in the first cell in the row.

When you insert a cross-reference to a numbered item, the _Ref bookmark Word creates should enclose the text of the target paragraph only. But when the rules above apply, Word creates a bookmark that encloses the entire row in which the paragraph is found and the cross-reference will show the number of the first paragraph in the bookmark. This means that the inserted cross-reference will show whatever number is found in the first paragraph in the first cell in the row instead of the number you selected. If the first paragraph in the first cell isn't numbered, the cross-reference will show 0. Therefore, the cross-references in the illustrations above show 0 instead of 1. and A instead of 2.

If a cross-referenced, numbered paragraph is the first paragraph in the first cell in a row, the bookmark would still be wrong but you wouldn't notice because the cross-reference would fetch the number for the correct paragraph in that situation.

If a cross-referenced, numbered paragraph is not the first paragraph in the first cell in a row, but if the first paragraph in the first cell in the row happens to be numbered with the same number as the selected target for the cross-reference, you wouldn't notice the problem either but the cross-reference would actually show the number from the wrong paragraph.

The bookmark problem is illustrated below. The field codes of the first REF field are shown (above the arrow) and the bookmark has been selected in the Bookmark dialog box:

Cross-reference field shows wrong number because the bookmark encloses the entire row instead of the cross-referenced paragraph only

How to prevent or correct the problem

In order to prevent the problem with wrong cross-references to empty, numbered paragraphs in tables, Word must be forced to create correct _Ref bookmarks. You can solve the problem as follows:

  • Add a space in the numbered paragraph before creating the cross-reference

The space will cause Word to create a correct bookmark and thereby a correct cross-reference. You could add any other character than a space but a space will not be visible in the final document. See the illustrations below:

Cross-reference field shows wrong number because the bookmakr encloses the entire row instead of the cross-reference paragraph only

The solution with the space is only illustrated with one of the two examples above but it will work in all cases.


Cross-reference field shows wrong number because the bookmakr encloses the entire row instead of the cross-reference paragraph only

If you have already inserted cross-references that are wrong due to wrong bookmarks, the easiest solution is most likely to correct each instance by adding a space in the target paragraph as illustrated above, then delete the wrong cross-reference and create a new cross-reference.

Alternatively, you would have to correct each of the wrong bookmarks. To correct the bookmarks, follow the principles shown in the demos included with Problem 1, Problem 2 and Problem 3. You can manually delete the old and wrong bookmarks if you want to get rid of those bookmarks. They do not harm but they clutter the collection of bookmarks.

Another way of repairing wrong cross-reference fields

The demos included with Problem 1, Problem 2 and Problem 3 above describe how to correct errors in cross-reference fields by correcting the _Ref bookmarks to which the cross-reference fields point. Alternatively, you could delete each incorrect cross-reference field and replace it by a new field. However, this would leave the wrong _Ref bookmarks in the document and thereby clutter the collection of bookmarks.


Top of page

Back to Word Tips ...



Copyright © 2006-2017 Lene Fredborg – DocTools ApS – all rights reserved | Microsoft Word Templates – add-ins – VBA macros | Save time and work more efficiently in Microsoft Word
Privacy policy | Terms of use | Cookies policy | Bookmark this page | Tip a friend | Links | Contact