Syntax
ExistingBookmark(Name$)
Remarks
Indicates whether the bookmark specified by Name$ exists in the active document. This function returns the following values.
Value | Explanation |
–1 | If the bookmark exists |
0 (zero) | If the bookmark does not exist |
Example
This macro displays a prompt in the status bar for the name of a bookmark to add. If the bookmark does not yet exist, it is added. If the bookmark already exists, Word displays a message box that asks whether to reset the bookmark. If the user answers No, the macro ends. Otherwise, the bookmark is reset.
Sub MAIN Input "Bookmark to add", myMark$ If ExistingBookmark(myMark$) Then ans = MsgBox(myMark$ + " already exists; reset?", 36) If ans = 0 Then Goto bye End If EditBookmark myMark$, .Add bye: End Sub
See Also
BookmarkName$(), CmpBookmarks(), CountBookmarks(), EditBookmark, EmptyBookmark(), GetBookmark$()