Table of contents
Collapse the table of content
Expand the table of content

Selection.Move Method (Visio)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Moves a selection a specified distance.


expression . Move( dx , dy , UnitsNameOrCode )

expression A variable that represents a Selection object.


NameRequired/OptionalData TypeDescription
dxRequiredDoubleSpecifies the amount to move in the x-direction.
dyRequiredDoubleSpecifies the amount to move in the y-direction.
UnitsNameOrCodeOptionalVariantSpecifies the units to use for dx and dy. See Remarks for possible values. The default is inches.

Return Value



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.


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.Select vsoShape1, visSelect 
 ActiveWindow.Select vsoShape2, visSelect 
 Application.ActiveWindow.Selection.Move 2, 2 

End Sub
© 2018 Microsoft