How find and fix broken xrefs?

I have a longish document (100+ pages) with many cross-references in it.  Some of them are clearly broken, where "broken" means they don't generate the text that they should. For example, I currently have some text that refers to sections 2 and 2, but it should refer to sections 2 and 3. Expanding the fields generating the text with the section numbers yields the following:

{ REF _Ref349679295 \# 0 \n \h }

{ REF _Ref361235576 \# 0 \n \h }


It seems clear to me that these xrefs should refer to distinct locations, because the REF values are different.  But they both generate the text "2". 


My general desire is to have a reliable way to ensure that all my xrefs are generating the correct text.  (Yes, I've updated all the fields in my document by selecting all the text and then hitting F9.)  The second xref above is currently generating incorrect text ("2" instead of "3").


I assume that each of those REF values should correspond to some target location. How can I find the target location for each of them?  Can section 2 have two identical target values?


All my xrefs are based on Numbered Items.


Thanks for your help.



Yes, each REF field refer to a location in the document; more precisely, it refers to a hidden bookmark. (The initial "_" in { REF _Ref349679295 \# 0 \n \h } indicates a hidden bookmark.)

The problem with bookmarks is that if you press Enter, or add content, at the beginning of a bookmarked/cross-referenced paragraph, the bookmark expands to include your added content. The workaround is the following: Always add content or press Enter at the end of an existing paragraph.

To fix incorrect cross-references, you can simply recreate them, which obviously will be time-consuming in a long document with many references.

Alternatively, you can redefine an existing, incorrect bookmark, but it may also be time-consuming, I'm afraid. (It may not always work, either.) Here's how to do it:

Let's say that a cross-reference refers to paragraph A and the following paragraph B when you really know it should reference only B. Then do as follows: Select paragraph B. Click Insert | Bookmark. Select "Hidden bookmarks." Now, switch the sort order from "Name" to "Location" (or vice versa). You should see the name of the bookmark at the insertion point. Click the Add button to redefine the bookmark. Close the dialog box and see if you can update the cross-reference.

[Edited for clarity]           
Stefan Blom
Microsoft 365 Word MVP since 2005
Volunteer Moderator (Office)
MS 365, Win 11 Pro
~~~~
Please note that I do not work for Microsoft
MVP program info: https://mvp.microsoft.com/
~~~~

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

How can I find the hidden bookmark that an xref refers to? For example, I know that the xref referring to _Ref361235576 is generating the wrong text. How can I find out what location that xref refers to?

Thanks.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Once you have figured out the name of the bookmark, you can use the Go To button in the Insert | Bookmark dialog box. But redefining the bookmarks as I described in my previous message will be more useful.
Stefan Blom
Microsoft 365 Word MVP since 2005
Volunteer Moderator (Office)
MS 365, Win 11 Pro
~~~~
Please note that I do not work for Microsoft
MVP program info: https://mvp.microsoft.com/
~~~~

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

When I Go To the hidden bookmarks, I don't see any visual indication of where the bookmark marker is positioned.  I have "Show bookmarks" checked in Word Options. How can I see precisely where the bookmark is located?

Also, when I Go To a bookmark, a region of text is highlighted. What is the significance of this highlighted region of text? 

If there is someplace on the web I can read about these things (hence sparing you my questions), please let me know.  I try to search before I post questions, but I think that at this point, I don't know enough about how Word works to compose the proper queries.


1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Unfortunately, hidden bookmarks won't be displayed even if you choose to display bookmarks in Word Options. You can see the range enclosed by a bookmark if you click Go To in the Bookmark dialog box.

For another example of redefining a bookmark, see Suzanne S. Barnhill's article at http://wordfaqs.mvps.org/CombineXrefs.htm.

Usually, "redefining" actually means shrinking the range that the bookmark encloses (but in reality you can move any bookmark by re-adding one with the same name).

Stefan Blom
Microsoft 365 Word MVP since 2005
Volunteer Moderator (Office)
MS 365, Win 11 Pro
~~~~
Please note that I do not work for Microsoft
MVP program info: https://mvp.microsoft.com/
~~~~

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Unfortunately, hidden bookmarks won't be displayed even if you choose to display bookmarks in Word Options. You can see the range enclosed by a bookmark if you click Go To in the Bookmark dialog box.


Okay, the fundamental problem appears to be that the bookmark for section 2 encompasses all the text of the section 2 section header, while the bookmark for section 3 encompasses all the text for the section 2 section header plus all the text of section 2 plus the text of the section 3 section header. This explains why the xref to section 3 is showing the number for section 2: the bookmark for section 3 starts at the beginning of section 2 and extends into section 3. This probably happened while I was thrashing around trying to remove the text effects from my section headings (which is a different problem). My thrashing took place around sections 2 and 3.


So what I need to do is to change the range of text associated with the bookmark for section 3.  Earlier you wrote:


Alternatively, you can redefine an existing, incorrect bookmark, but it may also be time-consuming, I'm afraid. (It may not always work, either.) Here's how to do it:

Let's say that a cross-reference refers to paragraph A and the following paragraph B when you really know it should reference only B. Then do as follows: Select paragraph B. Click Insert | Bookmark. Select "Hidden bookmarks." Now, switch the sort order from "Name" to "Location" (or vice versa). You should see the name of the bookmark at the insertion point. Click the Add button to redefine the bookmark. Close the dialog box and see if you can update the cross-reference.


Is this the recommended way to achieve what I want to achieve, bearing in mind that I'm dealing with a hidden system-inserted bookmark?  The "It may not always work, either" disclaimer worries me. Note that I don't want to delete the section 3 bookmark, because what will cause cross-references to break.


Thanks.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Yes, when a bookmark has been "expanded" to include more than one numbered item, the cross-reference to the paragraph number will display the first number it finds.

My recommendation would be recreating the cross-references rather than trying to "fix" the existing ones.

Stefan Blom
Microsoft 365 Word MVP since 2005
Volunteer Moderator (Office)
MS 365, Win 11 Pro
~~~~
Please note that I do not work for Microsoft
MVP program info: https://mvp.microsoft.com/
~~~~

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Stefan,

Is there a way to see a list of all my references and eliminate the ones I don't want anymore?

My document is also really long and has lots of xreferences. A previous version of the document had a list of "fixtures and components" and as the names were being changed a lot, I decided to put references to that list instead of typing and retyping the names all over again every time somebody decided to change a part name.

Now that list is gone from the document and, of course, my document got filled with "REF NOT FOUND" errors. I fixed most of them by deleting and rewriting the text by hand. But in more than one occasion word keeps adding the error, even though I deleted the reference (the gray highlighted text). 

It is really annoying because now every time I save or print the document it gets filled up with "REF NOT FOUND" bold texts where there was no reference anymore.

I am wondering if there's a way to look at the list of references and delete the not desired ones.

Thanks!


Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Press Alt+F9 to display field codes. You can then use the Find and Replace dialog box (Ctrl+H) to locate the REF (cross-reference) fields. For example, to delete all REF fields, you can enter ^d REF in the "Find what" box, leave the "Replace with" box empty and then click Replace All.
Stefan Blom
Microsoft 365 Word MVP since 2005
Volunteer Moderator (Office)
MS 365, Win 11 Pro
~~~~
Please note that I do not work for Microsoft
MVP program info: https://mvp.microsoft.com/
~~~~

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated March 25, 2024 Views 21,085 Applies to: