EditBookmark

Syntax

EditBookmark .Name = text [, .SortBy = number] [, .Add] [, .Delete] [, .Goto]

Remarks

Adds, deletes, or selects the specified bookmark. The arguments for the EditBookmark statement correspond to the options in the Bookmark dialog box (Edit menu).

Argument

Explanation

.Name

The name of the bookmark

.SortBy

Controls how the list of bookmarks is sorted when you display the Bookmark dialog box with a Dialog or Dialog() instruction:

0 (zero) By name

1 By location


You can specify only one of the following arguments.

Argument

Explanation

.Add

Adds a bookmark at the insertion point or selection

.Delete

Deletes the bookmark

.Goto

Moves the insertion point or selection to the bookmark


If you do not specify .Add, .Delete, or .Goto, Word adds the bookmark.

Example

This example searches for a paragraph containing only the word "Index" (that is, the heading for the index), and then, if the heading is found, adds a bookmark in front of it. You could use this bookmark in another EditBookmark instruction or with EditGoTo to move the insertion point to the index.


StartOfDocument
EditFind .Find = "^pIndex^p", .MatchCase = 1, \
    .Direction = 0, .Format = 0
If EditFindFound() Then
    CharLeft : CharRight
    EditBookmark .Name = "Index", .Add
End If

See Also

BookmarkName$(), CmpBookmarks(), CopyBookmark, CountBookmarks(), EditGoTo, EmptyBookmark(), ExistingBookmark(), GetBookmark$(), SetEndOfBookmark, SetStartOfBookmark