EmptyBookmark()

Syntax

EmptyBookmark(Name$)

Remarks

Determines whether Name$ is an "empty" bookmark. An empty bookmark marks only a location for the insertion point in a document; it does not mark any text. You can use EmptyBookmark() to verify that a bookmark (for example, a bookmark referred to in a REF field) does indeed mark text.

This function returns the following values.

Value

Explanation

–1

If the bookmark is empty (that is, it marks no text)

0 (zero)

If the bookmark is not empty or does not exist


Example

This example verifies that the bookmark referred to in each REF field both exists and is not empty. If a reference to a nonexistent or empty bookmark is encountered, an appropriate message box is displayed.


StartOfDocument
ViewFieldCodes 1
EditFind .Find = "^d REF", .Format = 0, .Wrap = 0
While EditFindFound()
    CharLeft
    WordRight 2
    WordRight 1, 1
    mark$ = RTrim$(Selection$())
    If Not ExistingBookmark(mark$) Then
        MsgBox mark$ + " is not a bookmark."
    ElseIf EmptyBookmark(mark$) Then
        MsgBox mark$ + " is an empty bookmark."
    End If
    CharRight
    EditFind .Find = "^d REF", .Format = 0, .Wrap = 0
Wend

See Also

BookmarkName$(), CmpBookmarks(), CountBookmarks(), EditBookmark, ExistingBookmark(), GetBookmark$()