Share via


Paste Method [Visio 2003 SDK Documentation]

As it applies to the Characters object.

Pastes the text range on the Clipboard into an object.

object**.Paste**()

object     Required. An expression that returns the Characters object to paste into.

Version added

2.0

As it applies to the Master, Page, and Shape objects.

Pastes the contents of the Clipboard into an object.

object**.Paste** ([Flags])

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

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

Version added

2002

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 Flags 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 use visCopyPasteNoTranslate to copy, you should also use that value to paste, because that 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 Office Word document), use the PasteSpecial method.

Example

As it applies to the Page object.

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Paste method. It draws a rectangle, copies it, and then pastes the copy onto the drawing page.

Public Sub Paste_Example() 

    Dim vsoShape As Visio.Shape 

    'Draw a rectangle. 
    Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)
 
    'Copy the shape to the Clipboard.
    vsoShape.Copy 

    'Paste the copy onto the drawing page. 
    ActivePage.Paste 

End Sub  

Applies to | Characters object | Master object | Masters collection | MasterShortcuts collection | Page object | Shape object

See Also | Copy method | Cut method | Delete method | Duplicate method | Type property