PasteSpecial Method (DialogSheet or Worksheet Object)

Applies To

DialogSheet Object, Worksheet Object.

Description

Pastes the contents of the Clipboard onto the sheet using a specified format. Use this method to paste data from other applications or paste in a specific format.

Syntax

object.PasteSpecial(format, link, displayAsIcon, iconFileName, iconIndex, iconLabel)

object

Required. The DialogSheet or Worksheet object.

format

Required. Specifies the clipboard format of the data to paste (as text).

link

Optional. If True, a link is established to the source of the pasted data. If the source data is not suitable for linking or the source application doesn't support linking, this parameter is ignored. The default value is False.

displayAsIcon

Optional. If True, the pasted data is displayed as an icon. The default value is False.

iconFileName

Optional. The name of the file that contains the icon to use if displayAsIcon is True.

iconIndex

Optional. The index number of the icon within the icon file.

iconLabel

Optional. The text label of the icon.

Remarks

You must select the destination range before you use this method.

This method may modify the sheet selection depending on the contents of the Clipboard. For example, pasted drawing objects remain selected.

See Also

Copy Method, Cut Method, Paste Method (DialogSheet or WorkSheet Object), PasteSpecial Method (Range Object).

Example

This example pastes a Microsoft Word version 6.0 document object from the Clipboard to cell D1 on Sheet1.


Worksheets("Sheet1").Range("D1").Select
ActiveSheet.PasteSpecial format:="Microsoft Word 6.0 Document Object"

This example pastes the same Microsoft Word version 6.0 document object and displays it as an icon.


Worksheets("Sheet1").Range("F5").Select
ActiveSheet.PasteSpecial _
        format:="Microsoft Word 6.0 Document Object", _
        displayAsIcon:=True