Share via


Move Method [Visio 2003 SDK Documentation]

Moves a selection a specified distance. Returns Nothing.

object**.Move**(dX, dY,[UnitsNameOrCode])

object    Required. An expression that returns a Selection object that contains the shapes to move.

dX   Optional Double. Specifies the amount to move in the X-direction.

dY   Optional Double. Specifies the amount to move in the Y-direction.

UnitsNameOrCode   Optional Variant. Specifies the units to use for dX and dY. See Remarks for possible values. The default is inches.

Version added

2003

Remarks

You can specify UnitsNameOrCode as an integer (a member of VisUnitCodes) or a string value such as "inches". If the string is invalid or the unit code is inappropriate (nontextual), an error is generated.

For a complete list of valid unit strings along with corresponding Automation constants (integer values), see About units of measure.

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the Move method to move a selection by a specified amount.

Public Sub Move_Example()

    Dim vsoShape1 As Visio.Shape
    Dim vsoShape2 As Visio.Shape    
    
    Set vsoShape1 = Application.ActiveWindow.Page.DrawRectangle(1, 9, 3, 7)
    Set vsoShape2 = Application.ActiveWindow.Page.DrawRectangle(3, 6, 5, 5)
    
    ActiveWindow.DeselectAll
    
    ActiveWindow.Select vsoShape1, visSelect
    ActiveWindow.Select vsoShape2, visSelect    
    Application.ActiveWindow.Selection.Move 2, 2

End Sub

Applies to | Selection object