Selection.PasteSpecial Method
Inserts the contents of the Clipboard.
Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.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 _
)
'Usage
Dim instance As Selection
Dim IconIndex As Object
Dim Link As Object
Dim Placement As Object
Dim DisplayAsIcon As Object
Dim DataType As Object
Dim IconFileName As Object
Dim IconLabel As Object
instance.PasteSpecial(IconIndex, Link, _
Placement, DisplayAsIcon, DataType, _
IconFileName, IconLabel)
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%
Optional 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 (Insert menu, Object command, Create New tab): 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%
Optional Object. True to create a link to the source file of the Clipboard contents. The default value is False.
- Placement
Type: System.Object%
Optional Object. Can be either of the following WdOLEPlacement constants: wdFloatOverText or wdInLine. The default value is wdInLine.
- DisplayAsIcon
Type: System.Object%
Optional Object. Optional Object. True to display the link as an icon. The default value is False.
- DataType
Type: System.Object%
Optional Object. A format for the Clipboard contents when they're inserted into the document. WdPasteDataType.
- IconFileName
Type: System.Object%
Optional 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%
Optional Object. If DisplayAsIcon is True, this argument is the text that appears below the icon.
Remarks
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 doesn't expand to include the contents of the Clipboard.
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).