Partager via


Bookmark.Delete Method (Word)

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.

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

Concepts

Bookmark Object Members

Bookmark Object