In this article, we would like to show you 2 useful ways to prevent reference errors caused by changing bookmark text.
Accidental Deletion of Bookmark Causing Reference Errors
Now and then, when drafting a Word document, we often insert bookmark and use cross-reference to quickly jump to a specific location. Now here is today’s issue. If we change the text of a bookmark which has been cross-referenced, and update the reference field, we often encounter with an error message, such as bellow:
Why would it happen? The very answer is we are likely to accidentally delete the original bookmark field. Because we usually only select the texts we need, excluding the spaces before and after, to set it as bookmark, we are easily to delete the field when we select the texts again as to change contents. The bookmark field is replaced with a plain text. And with bookmark nowhere to find, the reference surely cannot be updated. Then here goes the updating error.
Thus, here are 2 workarounds.
Method 1: Replace Bookmark Text inside its Field
- In case you get lost with too many bookmarks, here we use the “Go To” function to locate the target bookmark. Click “Home” then the arrow button next to the “Find”. Then choose “Go To” to open “Find and Replace” dialog box.
- Now select “Bookmark” and choose a bookmark then click “Go To”.
- Next put cursor inside the bookmark text to enter new contents there. After this, delete the original text.
- Then press “Ctrl+ A” to select the entire document and press “F9” to update references.
Method 2: Run Word Macro
- Firstly, press “Alt+ F11” to trigger the VBA editor.
- Secondly, click “Normal” and then “Insert” tab.
- Choose “Module” to insert a new one under “Normal” project.
- Next double click to bring out the coding area on the right side and paste the following macro:
Sub ChangeTheBookMarkTextAndUpdateCrossReference() Dim strBookMarkName As String Dim strNewText As String Dim objBookMarkRange As Range ' Input the bookmark name and text that you want to change. strBookMarkName = InputBox("Enter the bookmark name which you want to change it's text", "BookMark Name", "For example: DWORDR") strNewText = InputBox("Enter the bookmark text which you want to change", "New Bookmark Text", "For example: New text") With ActiveDocument If .Bookmarks.Exists(strBookMarkName) Then Set objBookMarkRange = .Bookmarks(strBookMarkName).Range objBookMarkRange.Text = strNewText .Bookmarks.Add Name:=strBookMarkName, Range:=objBookMarkRange .Fields.Update Else MsgBox ("The Bookmark: " & strBookMarkName & " is not founded.") End If End With Set objBookMarkRange = Nothing End Sub
- Now click “Run”.
- In the first box popping up, enter bookmark name and click “OK”.
- Next enter new bookmark text in the second box and click “OK” finally.
Method 2 can bypass the awkwardness of unintentionally delete bookmark field.
Handle Word Errors
The versatility use of Word makes it one of the most popular products. Then there is also the necessity to get a tool to recover Word in case it fails. If we don’t handle the problem as soon as possible, more Word documents can get corrupted.
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xlsx recovery and pdf repair software products. For more information visit www.datanumen.com