NamedRange::PasteSpecial Method (XlPasteType, XlPasteSpecialOperation, Object^, Object^)

 

Pastes the contents of a Microsoft.Office.Interop.Excel::Range object from the Clipboard into the NamedRange control.

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

Object^ PasteSpecial(
	XlPasteType Paste = XlPasteType::xlPasteAll,
	XlPasteSpecialOperation Operation = XlPasteSpecialOperation::xlPasteSpecialOperationNone,
	Object^ SkipBlanks,
	Object^ Transpose
)

Parameters

Paste
Type: Microsoft.Office.Interop.Excel::XlPasteType

The part of the range to be pasted.

Can be one of the following XlPasteType values:

xlPasteAll

xlPasteAllExceptBorders

xlPasteColumnWidths

xlPasteComments

xlPasteFormats

xlPasteFormulas

xlPasteFormulasAndNumberFormats

xlPasteValidation

xlPasteValues

xlPasteValuesAndNumberFormats

Operation
Type: Microsoft.Office.Interop.Excel::XlPasteSpecialOperation

The paste operation.

Can be one of the following XlPasteSpecialOperation values:

xlPasteSpecialOperationAdd

xlPasteSpecialOperationDivide

xlPasteSpecialOperationMultiply

xlPasteSpecialOperationNone

xlPasteSpecialOperationSubtract

SkipBlanks
Type: System::Object^

true to not have blank cells in the range on the Clipboard pasted into the destination range. The default value is false.

Transpose
Type: System::Object^

true to transpose rows and columns when the range is pasted. The default value is false.

Return Value

Type: System::Object^

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example uses the Copy method to copy the contents of a NamedRange control named NamedRange1 to the Clipboard, and then uses the PasteSpecial method to paste these contents into a NamedRange control named NamedRange2. The Operation parameter is set to xlPasteSpecialOperationAdd so that the content of each cell in NamedRange1 is added to the corresponding cell in NamedRange2.

This example is for a document-level customization.

No code example is currently available or this language may not be supported.
Return to top
Show: