Partager via


TextRange.PasteSpecial Method (PowerPoint)

Replaces the text range with the contents of the Clipboard in the format specified.

Syntax

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

expression A variable that represents a TextRange object.

Parameters

Name

Required/Optional

Data Type

Description

DataType

Optional

PpPasteDataType

A format for the Clipboard contents when they're inserted into the document. The default value varies, depending on the contents in the Clipboard. An error occurs if the specified data type in the DataType argument is not supported by the clipboard contents.

DisplayAsIcon

Optional

MsoTriState

MsoTrue to display the embedded object (or link) as an icon.

IconFileName

Optional

String

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

IconIndex

Optional

Long

If DisplayAsIcon is set to msoTrue, this argument is a number that corresponds to the icon you want to use in the program file specified by IconFilename. For example, 0 (zero) corresponds to the first icon, 1 corresponds to the second icon. If this argument is omitted, the first (default) icon is used. If DisplayAsIcon is set to msoFalse, then this argument is ignored. If IconIndex is outside the valid range, then the default icon (index 0) is used.

IconLabel

Optional

String

If DisplayAsIcon is set to msoTrue, this argument is the text that appears below the icon. If this label is missing, Microsoft PowerPoint generates an icon label based on the Clipboard contents. If DisplayAsIcon is set to msoFalse, then this argument is ignored.

Link

Optional

MsoTriState

Determines whether to create a link to the source file of the Clipboard contents. An error occurs if the Clipboard contents do not support a link.

Return Value

TextRange

Remarks

Valid data types for the TextRange object are ppPasteText, ppPasteHTML, and ppPasteRTF (any other format generates an error). If the paste succeeds, this method returns a TextRange object representing the text range that was pasted.

The DataType parameter value can be one of these PpPasteDataType constants.

ppPasteDefault

ppPasteHTML

ppPasteRTF

ppPasteText

The DisplayAsIcon parameter value can be one of these MsoTriState constants.

Constant

Description

msoFalse

The default. Does not display the embedded object (or link) as an icon.

msoTrue

Displays the embedded object (or link) as an icon.

An error occurs if there is no data on the Clipboard when the PasteSpecial method is called.

See Also

Concepts

TextRange Object Members

TextRange Object