WD: Jumping to a Bookmark Located in a Header or Footer

ID: Q113758

The information in this article applies to:

SUMMARY

The versions of Word listed above allow you to insert bookmarks into a document header or footer. In versions of Word prior to Word 97 and Word 98 Macintosh Edition, you can only jump to a bookmark in a document header or footer when the header or footer pane is active.

This article contains macro samples that demonstrate how to jump to a bookmark in a header or footer.

MORE INFORMATION

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/support/supportnet/refguide/

This example shows how to jump to a bookmark in the document header:

1. On the View menu, click Header And Footer.

2. On the Edit menu, click Bookmark.

3. Select a bookmark name, and then click Go To.

NOTE: Bookmarks in the header or footer pane are not listed in the Edit Go To dialog box, regardless of where the insertion point is located.

WordBasic can open the document header or footer, check that the bookmark exists, and then go to the bookmark using the EditBookmark statement.

The following sample macro opens the header pane and goes to the bookmark named Test.

   Sub MAIN
      If ViewHeader() = 0 Then ViewHeader
      If ExistingBookmark("test") Then
         EditBookmark "test", .Goto
      End If
   End Sub

The following sample macro opens the footer pane and goes to the bookmark named Test.

   Sub MAIN
      If ViewFooter() = 0 Then ViewFooter
      If ExistingBookmark("test") Then
         EditBookmark "test", .Goto
      End If
   End Sub

Additional query words: editbookmark go to
Keywords          : kbmacroexample winword word6 winword2 word7 word95 macword6 word 
Version           : WINDOWS: 2.x 6.0 6.0a 6.0c 7.0 7.0a; MACINTOSH: 6.0,6.01,6.01a
Platform          : MACINTOSH WINDOWS
Issue type        : kbhowto

Last Reviewed: April 9, 1999