WD: Cannot Go to Bookmark in a Subdocument

ID: Q105885

The information in this article applies to:

SYMPTOMS

When you use the Go To command in Microsoft Word, you cannot go from one subdocument (or document component) to a bookmark in another subdocument or the main body of the document. Similarly, you cannot go from the main body of a document to a bookmark in a subdocument. In other words, you cannot go from one layer of a document to a bookmark in another layer. The bookmark does not appear on the Bookmark Name list in the Edit Go To dialog boxes. In the Edit Bookmark dialog box, the Go To button is unavailable when you select a bookmark in another layer or subdocument.

NOTE: As used in this article, the word "subdocument" refers to document components and not to the documents in a master document. The main body of the document is what you can see in normal view. The following document elements are examples of subdocuments or document components: headers or footers, footnotes, endnotes, annotations, text boxes, or callouts.

Examples

WORKAROUND

To work around this problem, use the appropriate method for your situation.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/ 

Method 1

Position the insertion point in the subdocument before you go to the bookmark.

Method 2 (Word 97 and Word 98)

Write a Visual Basic for Applications macro that checks for the existence of the bookmark and if it exists, goes to that bookmark. The following macro checks for and goes to the bookmark "test", if it exists:

   If ActiveDocument.Bookmarks.Exists("test") = True Then
      ActiveDocument.Bookmarks("test").Select
   Else
      MsgBox "Specified bookmark does not exist."
   End If

Method 3 (Word 6 and Word 7)

Write a WordBasic macro that goes to the text box and searches for a bookmark. The following macro searches for the first text box in the document and locates the bookmark called "test."

   Sub main
   DrawSetRange "\Doc"
   Select Case DrawGetType(1)
     Case 3   'Text box
        DrawSetInsertToTextbox 1
     Case 8   'Callout
        DrawSetInsertToTextbox 1
     Case Else
   End Select
   EditGoTo .Destination = "test"
   End Sub

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

There is an exception to this behavior. If the insertion point is in a header or footer when you click Go To on the Edit menu, Word moves the insertion point into the body of the document and returns it to the last position before you switched to the header or footer. This means you cannot go to a bookmark in the header or footer using the Go To command on the Edit menu. This does not happen when you use the Bookmark command on the Edit menu and click Go To; the insertion point stays in the header or footer and you can go to your bookmark, as expected.

Visual Basic for Applications Example

   Sub FindBookmark()
      ActiveWindow.ActivePane.View.Type = wdPageView
      ActiveWindow.View.SeekView = wdSeekCurrentPageHeader
      ActiveDocument.Bookmarks("test").Select
   End Sub

WordBasic Example

The following macro opens the Header/Footer and goes to the suggested bookmark.

   Sub Main
      ViewHeader(Footer)
      EditBookmark .Name="test", Goto
   End Sub

Additional query words: .goto argument sub-document sub document 8.0 8.00
Keywords          : kbmacro kbprg kbdtacode kbmacroexample winword macword word6 word7 word95 
Version           : WINDOWS: 6.0, 7.0, 97; MACINTOSH: 6.0, 6.0.1, 98
Platform          : MACINTOSH WINDOWS
Issue type        : kbbug

Last Reviewed: April 9, 1999