Paste method

Microsoft Visio Developer Reference

Paste method

       

Pastes the contents of the Clipboard into an object.

Version added

2002

Syntax

object.Paste [flags]

object

Required. An expression that returns the Page, Shape, or Master object to paste.

flags

Optional Variant. Determines how shapes are translated during the paste operation.

Remarks

The Paste method works only with Shape objects that are group shapes. Use the Type property of a shape to determine whether it is a group.

Possible values for flags are declared by the Visio type library in VisCutCopyPasteCodes, and are described in the following table.

Flag

Value

Description

visCopyPasteNormal

&H0

Default. Shapes are pasted to the center of the active window.

visCopyPasteNoTranslate

&H1

Shapes are pasted to their original coordinate locations.

Setting flag to visCopyPasteNormal is the equivalent of the behavior in the user interface. You should use the visCopyPasteNormal and visCopyPasteNoTranslate flags consistently. For example, if you copy using visCopyPasteNoTranslate, you should also paste using that value as it is the only way to ensure that shapes are pasted to their original coordinate location.

If you need to control the format of the pasted information and (optionally) establish a link to a source file (for example, a Microsoft Word document), use the PasteSpecial method.