Returning to the Source of a Cross-Reference

Written by Allen Wyatt (last updated August 3, 2024)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


4

Alan is writing a 900-page book with hundreds of hyperlinked cross-references. One thing he can't figure out is how to implement a way to take a reader back to where the hyperlink was clicked. Alan would like the reader to be able to follow the cross-reference by clicking, and then have a way for them to go back to where they clicked.

There are three ways you can approach this issue. Before getting to the three methods, however, it is important to consider exactly how Alan is creating the cross-references. You see, the term "cross-reference" is very specific in Word, and a cross-reference is created by using the Cross Reference tool on the Insert tab of the ribbon. A cross-reference (to either a bookmark or a heading style in the document) is implemented using a REF field.

A hyperlink, on the other hand, can work essentially the same as a cross-reference, but it is implemented using a HYPERLINK field. You create one by using the Link tool on the Insert tab of the ribbon and choosing "Place in this Document" as the target of your link. A hyperlink, too, can be to either a bookmark or a heading style.

Regardless of whether Alan is using cross-references (REF field) or hyperlinks (HYPERLINK field), they can be followed by using the mouse to point at the field and holding down the Ctrl key as the mouse button is clicked.

This brings us to the first approach to Alan's issue. Once followed, you can return to the source (where you Ctrl clicked) by pressing Alt+Left Arrow. This shortcut works whether you subsequently move the location of the insertion point or make any edits in the document. In other words, Alt+Left Arrow returns to the last place you Ctrl clicked to follow a cross-reference or a hyperlink. As a bonus, Alt+Left Arrow will step back through multiple Ctrl click actions. It is very similar, in this regard, to the Back button on a web browser.

Which brings us to the second approach—you can add a Back tool to the Quick Access Toolbar. Follow these steps:

  1. Display the Word Options dialog box. (In Word 2007 click the Office button and then click Word Options. In Word 2010 and later versions display the File tab of the ribbon and then click Options.)
  2. Select the Customize option (Word 2007) or Quick Access Toolbar option (Word 2010 and later versions) at the left side of the dialog box.
  3. Using the Choose Commands From drop-down list, choose either Commands Not in the Ribbon or All Commands.
  4. Scroll through the list of available commands and choose Back.
  5. Click the Add button. The command is moved to the list at the right of the dialog box.
  6. Click OK.

The Back tool now appears on the Quick Access Toolbar. It looks like a left-pointing arrow, very similar to the Back button visible in most web browsers. After you Ctrl click to follow a cross-reference or a hyperlink, you can click the Back tool to return to the point where you Ctrl clicked.

Both Alt+Left Arrow and the Back tool function exactly the same. If you are comfortable with keyboard shortcuts, you'll probably want to use Alt+Left Arrow. If you are more comfortable with using the mouse, then you'll probably want to use the Back tool. (Since you used the mouse to Ctrl click the cross-reference or hyperlink, you may want to use the mouse to get back to the source of the cross-reference or hyperlink, which means using the Back tool.)

The third approach is to add "reverse links" to get back to the source of the original cross-reference or hyperlink. This can get a bit tricky, but some people prefer it. For instance, you could add a bookmark at the location of the original cross-reference or hyperlink and then, at the target of the cross-reference or hyperlink add a hyperlink that says "Return to . . ." with its target being the bookmark you added.

Of course, this can get quite involved, and it can be quite a lot of work—especially in Alan's case where he indicates he has hundreds of hyperlinks. This approach doubles the number of bookmarks or hyperlinks in your document. You can, however, create a macro to do the tedious work of creating the return links. Here's an example of one that could work for you:

Sub ReverseLinkRefs()
    Dim fld As Field
    Dim bkmk As String
    Dim bkmkR As String
    Dim aRange As Range
    Dim destRange As Range
    Dim destText As String
    Dim lHCnt As Long
    Dim lRCnt As Long

    lHCnt = 0
    lRCnt = 0
    Selection.HomeKey Unit:=wdStory     ' Go to beginning of document
    Set aRange = Selection.Range
    Do
        ' Find next hyperlink or REF field
        aRange.MoveEnd Unit:=wdCharacter, Count:=1
        aRange.Start = aRange.End
        aRange.Select
        With Application.Browser
            .Target = wdBrowseField
            .Next
        End With

        Set aRange = Selection.Range
        aRange.MoveEnd Unit:=wdWord, Count:=1
        If aRange.Fields.Count = 0 Then Exit Do

        Set fld = aRange.Fields(1)
        bkmk = ""
        If fld.Type = wdFieldHyperlink Then
            bkmk = aRange.Hyperlinks(1).SubAddress
            lHCnt = lHCnt + 1
        ElseIf fld.Type = wdFieldRef Then
            bkmk = fld.Code
            bkmk = LTrim(Mid(bkmk, 5))
            If InStr(bkmk, " ") > 0 Then bkmk = Left(bkmk, InStr(bkmk, " ") - 1)
            lRCnt = lRCnt + 1
        End If

        If bkmk = "" Or Right(bkmk, 1) = "R" Then
            Set aRange = Selection.Range
            aRange.Start = aRange.End
            GoTo nxtfield
        End If
        If (fld.Type = wdFieldHyperlink And InStr(fld.Code, "\l") = 0) Then GoTo nxtfield
        If Not ActiveDocument.Bookmarks.Exists(bkmk) Then
            If bkmk <> "" Then MsgBox bkmk & " Bookmark does not exist"
            GoTo nxtfield
        End If

        ' Place bookmark ending in "R" at field
        fld.Select
        DoEvents
        bkmkR = bkmk & "R"
        ActiveDocument.Bookmarks.Add Range:=aRange, Name:=bkmkR

        ' Change reference to a hyperlink pointing to bookmark
        Set destRange = ActiveDocument.Bookmarks(bkmk).Range
        If destRange.Hyperlinks.Count = 0 Then ' Only one hyperlink per bookmark
            destText = destRange.Text
            With ActiveDocument.Hyperlinks.Add(Anchor:=destRange, _
              Address:="", SubAddress:=bkmkR, TextToDisplay:=destText)
                .Range.Fields.Update
                ActiveDocument.Bookmarks.Add Range:=.Range, Name:=bkmk
                .Range.Fields.Update
            End With
        End If

nxtfield:
        aRange.Select
    Loop
    MsgBox lHCnt & " Hyperlinks" & vbCrLf & lRCnt & " REF fields"
End Sub

The macro steps through each HYPERLINK and REF field and adds a bookmark at the field. It then makes the target of those fields into active hyperlinks (using a new HYPERLINK field) back to the original field using the added bookmark. The macro does not add any new text to the document; it only adds the new bookmarks and hyperlinks.

For the best results, you should run this macro only after you are completely done creating and editing your document. (In other words, you don't really want to run a macro such as this twice on a single document.) It is also a good idea to save the final document and then run the macro on a second copy of the document. That way, if something doesn't work as desired, you have the "clean" version of the final document to fall back on.

Naturally, the question will come up as to why go through the trouble of creating the return links, either manually or with a macro, when using Alt+Left Arrow or the Back tool are so much easier. There are two reasons. First, if the document you are working with will be used by others, you may not have the opportunity to teach them how to use the keyboard shortcut, and you probably don't want to instruct them on how to add the Back tool to the QAT. Second, if some of the other users are still using very old versions of Word (say, Word 2003 or older), then the shortcut key or Back tool may not be available in their version of Word.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13935) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Calculating Averages by Date

When you have a huge amount of daily data to analyze, you may want to calculate an average of values for any given date ...

Discover More

Word 2013 Styles and Templates (Table of Contents)

Styles are at the heart of Word's formatting power. Understanding how to use styles can greatly increase your ability to ...

Discover More

Accessing the Dirty Flag

When creating macros, you might want to know if a user has made changes in the document or not. Here's how to figure that ...

Discover More

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

More WordTips (ribbon)

Creating a List of Cross-References

Cross-referencing has long been a capability in Word documents. You can easily add and remove cross-references but ...

Discover More

Ignoring Punctuation in Names

If you have a word that includes punctuation as part of the word itself, then you may be frustrated by how Word treats ...

Discover More

Displaying Quick Document Statistics

Need to see how many pages, words, paragraphs, or lines are in your document? Word makes it easy to retrieve such ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five more than 0?

2024-08-05 09:02:03

Timothy J. McGowan

@Phillip Holt:

You may stop looking. The Alt+Left keystroke is definitely not available in iOS versions of Word, according to Google, nor any other key combination. According to Internet lore, Back was enabled in Word for Windows when Microsoft wanted to make the program more Web-like, and they changed their minds about that before the feature could be added to Word for iOS.


2024-08-04 14:13:24

Phillip Holt

This whole function aparently is unavailable on a MAC. Or I cannot find equivalent key to implement this funcion.


2024-08-04 05:06:48

Ken E

RON S

I agree that Word has problems with large and complex documents. Not only can the document become unstable but any editing and moving around the document will be very slow.

The largest document that I have worked on had 1800 pages and for editing was split into two documents before being combined into the final document. Most of the editing was done in draft mode to prevent re-pagination that cannot be turned off in Print Layout mode. Spell checking is always running in background even though it appears to be off in the options.


2024-08-04 03:29:16

Ron S

For a ~900 page document, with lots of cross references. Personally, in this size/complexity document I would stay away from the technique of adding "back to ..." links/cross references. Although it is more of an issue in older versions, Word still does have a problem with "document complexity". The more features you add, the more "complex" the document becomes. Sometimes this complexity leads you into parts of the program code that are rarely used and definitely not tested enough. This "bad code" can cause your document and/or Word to "crash". This can have various effects. The "best" is just losing unsaved changes. The "worst" is the document can no longer be opened.

For fear (due to personal experience) of "document corruption" I try to avoid "document complexity" when I can. This is one case where some can be avoided (don't add the back links).

An answer to users not knowing the shortcut or QAT button feature is to create a "how to ... use this document online" page. I'd put it somewhere up front, near the "introduction". Give them step by step instructions for USING the 2, or 3 techniques (NOT for inserting "back to" links!, just how to use them!)


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.