Selection.PasteSpecial method (Word)

Inserts the contents of the Clipboard.

Syntax

expression.PasteSpecial (IconIndex, Link, Placement, DisplayAsIcon, DataType, IconFileName, IconLabel)

expression Required. A variable that represents a Selection object.

Parameters

Name Required/Optional Data type Description
IconIndex Optional Variant 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. If this argument is omitted, this method uses the first (default) icon.
Link Optional Variant True to create a link to the source file of the Clipboard contents. The default value is False.
Placement Optional Variant Can be either of the WdOLEPlacement constants.
DisplayAsIcon Optional Variant True to display the link as an icon. The default value is False.
DataType Optional Variant A format for the Clipboard contents when they are inserted into the document. WdPasteDataType.
IconFileName Optional Variant 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 Optional Variant 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 Excel worksheet). If you don't want to replace the contents of the specified selection, use the Collapse method before you use this method. When you use this method, the selection does not expand to include the contents of the Clipboard.

Example

This example inserts the Clipboard contents at the insertion point as unformatted text.

Selection.Collapse Direction:=wdCollapseStart 
Selection.PasteSpecial DataType:=wdPasteText

See also

Selection Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.