PreviousBookmarkID Property

Microsoft Word Visual Basic

PreviousBookmarkID Property

       

Returns the number of the last bookmark that starts before or at the same place as the specified selection or range; returns 0 (zero) if there's no corresponding bookmark. Read-only Long.

Example

This example selects the previous bookmark in the active document.

num = Selection.PreviousBookmarkID
If num <> 0 Then ActiveDocument.Content.Bookmarks(num).Select

This example displays the name of the bookmark that precedes the second paragraph.

num = ActiveDocument.Paragraphs(2).Range.PreviousBookmarkID
If num <> 0 Then MsgBox ActiveDocument.Content.Bookmarks(num).Name