Document.Drop Method

Visio Automation Reference

Creates a new Master object by dropping an object onto a receiving object such as a stencil or document, or the Masters or MasterShortcuts collection.

Version Information
 Version Added:  Visio 2.0

Syntax

expression.Drop(ObjectToDrop, xPos, yPos)

expression   A variable that represents a Document object.

Parameters

Name Required/Optional Data Type Description
ObjectToDrop Required [UNKNOWN] The object to drop. While this is typically a Visio object such as a Master, Shape, or Selection object, it can be any OLE object that provides an IDataObject interface.
xPos Required Integer The x-coordinate at which to place the center of the shape's width or PinX.
yPos Required Integer The y-coordinate at which to place the center of the shape's height or PinY.

Return Value
Master

Remarks

Using the Drop method is similar to moving a shape with the mouse. The object dropped (ObjectToDrop) can be a master or a shape on the drawing page.

If ObjectToDrop is a Master, the pin of the master is dropped at the specified coordinates. A master's pin is often, but not necessarily, at its center of rotation.

To create a new master in a stencil, apply the Drop method to a Document object that represents a stencil (the stencil must be opened as an original or a copy rather than read-only). In this case, thexPos and yPos arguments are ignored, and the new master that is created is returned.

Example

The following example shows how to use the Drop method to create a master by dropping a shape onto a Document object.

Visual Basic for Applications
  
Public Sub Drop_Example()
Dim vsoShape As Visio.Shape 
Dim vsoMaster As Visio.Master 

Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1) 

'Create a master in the document. 
'The master appears on the document stencil. 
Set vsoMaster = ActiveDocument.Drop(vsoShape,  0, 0) 

End Sub

See Also