Share via


Bookmark.Delete Method

Word Developer Reference

Deletes the specified bookmark.

Syntax

expression.Delete

expression   Required. A variable that represents a Bookmark object.

Example

If a bookmark named "temp" exists in the active document, this example deletes the bookmark.

Visual Basic for Applications
  Sub DeleteBookmark()
    Dim intResponse As Integer
    Dim strBookmark As String
    
    strBookmark = "temp"
    
    intResponse = MsgBox("Are you sure you want to delete " _
        & "the bookmark named """ & strBookmark & """?", vbYesNo)
    
    If intResponse = vbYes Then
        If ActiveDocument.Bookmarks.Exists(Name:=strBookmark) Then
            ActiveDocument.Bookmarks(Index:=strBookmark).Delete
        End If
    End If
End Sub

See Also