Condividi tramite


Bookmark.PasteSpecial Method

Inserts the contents of the Clipboard into the Bookmark control.

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

Syntax

'Declaration
Sub PasteSpecial ( _
    ByRef IconIndex As Object, _
    ByRef Link As Object, _
    ByRef Placement As Object, _
    ByRef DisplayAsIcon As Object, _
    ByRef DataType As Object, _
    ByRef IconFileName As Object, _
    ByRef IconLabel As Object _
)
void PasteSpecial(
    ref Object IconIndex,
    ref Object Link,
    ref Object Placement,
    ref Object DisplayAsIcon,
    ref Object DataType,
    ref Object IconFileName,
    ref Object IconLabel
)

Parameters

  • IconIndex
    Type: System.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
    Type: System.Object%

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

  • DisplayAsIcon
    Type: System.Object%

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

  • IconFileName
    Type: System.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
    Type: System.Object%

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

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.

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 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
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);
}

.NET Framework Security

See Also

Reference

Bookmark Interface

Microsoft.Office.Tools.Word Namespace