Share via


Bookmark.PasteSpecial Method

Definition

Inserts the contents of the Clipboard into the Bookmark control.

public void PasteSpecial (ref object IconIndex, ref object Link, ref object Placement, ref object DisplayAsIcon, ref object DataType, ref object IconFileName, ref object IconLabel);
abstract member PasteSpecial : obj * obj * obj * obj * obj * obj * obj -> unit
Public Sub PasteSpecial (Optional ByRef IconIndex As Object, Optional ByRef Link As Object, Optional ByRef Placement As Object, Optional ByRef DisplayAsIcon As Object, Optional ByRef DataType As Object, Optional ByRef IconFileName As Object, Optional ByRef IconLabel As Object)

Parameters

IconIndex
Object

If DisplayAsIcon is true, this argument is a number that corresponds to the icon you want to use in the program file specified by IconFilename. Icons appear in the Change Icon dialog box: 0 (zero) corresponds to the first icon, 1 corresponds to the second icon, and so on. If this argument is omitted, the first (default) icon is used.

Link
Object

true to create a link to the source file of the Clipboard contents. The default value is false.

Placement
Object

Can be either of the following WdOLEPlacement constants: wdFloatOverText or wdInLine. The default value is wdInLine.

DisplayAsIcon
Object

true to display the link as an icon. The default value is false.

DataType
Object

A format for the Clipboard contents when they are inserted into the document. WdPasteDataType.

IconFileName
Object

If DisplayAsIcon is true, this argument is the path and file name for the file in which the icon to be displayed is stored.

IconLabel
Object

If DisplayAsIcon is true, this argument is the text that appears below the icon.

Examples

The following code example inserts the Clipboard contents in the Bookmark control as unformatted text. This example assumes that the Clipboard contains some text.

This example is for a document-level customization.

private void BookmarkPasteSpecial()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    
    object DataType = Word.WdPasteDataType.wdPasteText;
    bookmark1.PasteSpecial(ref missing, ref missing, ref missing,
        ref missing, ref DataType, ref missing, ref missing);
}
Private Sub BookmarkPasteSpecial()

    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")

    Bookmark1.PasteSpecial(DataType:=Word.WdPasteDataType.wdPasteText)

End Sub

Remarks

Unlike with the Paste method, with PasteSpecial you can control the format of the pasted information and (optionally) establish a link to the source file (for example, a Microsoft Office Excel worksheet).

Calling this method might delete the Bookmark control.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Applies to