Skip to main content
Version: 20 R5 BETA

VP Copy to object

History
ReleaseChanges
19 R4Added

VP Copy to object ( rangeObj : Object {; options : Object} ) : Object

ParameterTypeDescription
rangeObjObject->Range object
optionsObject->Additional options
ResultObject<-Object returned. Contains the copied data

Description

The VP Copy to object command copies the contents, style and formulas from rangeObj to an object.

In rangeObj, pass the cell range with the values, formatting, and formulas to copy. If rangeObj is a combined range, only the first one is used.

You can pass an optional options parameter with the following properties:

PropertyTypeDescription
copyBooleanTrue (default) to keep the copied values, formatting and formulas after the command executes. False to remove them.
copyOptionsLongintSpecifies what is copied or moved. Possible values:

ValueDescription
vk clipboard options all (default)Copies all data objects, including values, formatting, and formulas.
vk clipboard options formattingCopies only the formatting.
vk clipboard options formulasCopies only the formulas.
vk clipboard options formulas and formattingCopies the formulas and formatting.
vk clipboard options valuesCopies only the values.
vk clipboard options value and formattingCopies the values and formatting.

The paste options defined in the workbook options are taken into account.

The command returns an object that contains the copied data.

Example

This code sample first stores the contents, values, formatting and formulas from a range to an object, and then pastes them in another range:

var $originRange; $targetRange; $dataObject; $options : Object

$originRange:=VP Cells("ViewProArea"; 0; 0; 2; 5)

$options:=New object
$options.copy:=True
$options.copyOptions:=vk clipboard options all

$dataObject:=VP Copy to object($originRange; $options)

$targetRange:=VP Cell("ViewProArea"; 4; 0)
VP PASTE FROM OBJECT($targetRange; $dataObject; vk clipboard options all)

See also

VP PASTE FROM OBJECT
VP MOVE CELLS
VP Get workbook options
VP SET WORKBOOK OPTIONS