Bookmark.Copy Method (2007 System)

Creates a new Bookmark in the same location as the existing Microsoft.Office.Tools.Word.Bookmark control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
Public Sub Copy
'Usage
Dim instance As Bookmark

instance.Copy()
public void Copy()
public:
void Copy()
public function Copy()

Remarks

The new bookmark is a Bookmark object rather than a Microsoft.Office.Tools.Word.Bookmark control.

Examples

The following code example adds a Bookmark control to the document and then creates a BeforeRightClick event handler. When the Bookmark control is right-clicked, the text within the bookmark is copied to the Clipboard.

This example is for a document-level customization.

WithEvents Bookmark3 As Microsoft.Office.Tools.Word.Bookmark

Private Sub BookmarkBeforeRightClick()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Bookmark3 = Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark3")
    Bookmark3.Text = "This is a sample bookmark." 
End Sub 

Private Sub Bookmark3_BeforeRightClick(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ClickEventArgs) _
    Handles Bookmark3.BeforeRightClick
    Bookmark3.Copy()
    e.Cancel = True 
End Sub
Microsoft.Office.Tools.Word.Bookmark bookmark3;

private void BookmarkBeforeRightClick()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    bookmark3 = this.Controls.AddBookmark(this.Paragraphs[1]
        .Range, "bookmark3");
    bookmark3.Text = "This is a sample bookmark.";
    bookmark3.BeforeRightClick += new Microsoft.Office.Tools
        .Word.ClickEventHandler(bookmark3_BeforeRightClick);
}

void bookmark3_BeforeRightClick(object sender, 
    Microsoft.Office.Tools.Word.ClickEventArgs e)
{
    bookmark3.Copy();
    e.Cancel = true;
}

.NET Framework Security

See Also

Reference

Bookmark Class

Bookmark Members

Copy Overload

Microsoft.Office.Tools.Word Namespace