Word

List Bookmarks in a Document

Ease of Use

Easy

Version tested with

2000 

Submitted by:

Anne Troy

Description:

Provides a messagebox with a list of all bookmarks in the active document. 

Discussion:

You may need to see a list of all the bookmarks in your document. This macro is helpful in providing that list. They are listed in the order in which they are located in the document. 

Code:

instructions for use

			

Option Explicit Sub GetBmks() Dim bmk As Bookmark Dim msg As String For Each bmk In ActiveDocument.Range.Bookmarks msg = msg & bmk.Name & vbCr Next bmk MsgBox msg End Sub

How to use:

  1. Copy the code above.
  2. Open the file that contains the bookmarks.
  3. Hit Alt+F11 to open the Visual Basic Editor (VBE).
  4. Select the file on the left.
  5. Choose Insert-Module and paste the code into the new code window at right.
  6. Save the file and close the VBE.
 

Test the code:

  1. Tools-Macro-Macros and double-click GetBmks.
 

Sample File:

getbookmarks.zip 5.66KB 

Approved by mdmackillop


This entry has been viewed 135 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express