Selection.Rotate method (Visio)

Rotates selected shapes either as a group or individually about their pins.

Syntax

expression. Rotate( _Angle_ , _AngleUnitsNameOrCode_ , _BlastGuards_ , _RotationType_ , _PinX_ , _PinY_ , _PinUnitsNameOrCode_ )

expression A variable that represents a Selection object.

Parameters

Name Required/Optional Data type Description
Angle Required Double Specifies the angle to rotate the selection. See Remarks for possible values.
AngleUnitsNameOrCode Optional Variant Specifies the units to use for Angle. See Remarks for possible values. The default is degrees.
BlastGuards Optional Boolean True to override formulas in the ShapeSheet of any of the selected shapes to which the GUARD function has been applied; False to leave guarded formulas unchanged. The default is False.
RotationType Optional VisRotationTypes Specifies how the selection is to be rotated. See Remarks for possible values.
PinX Optional Double When RotationType is visRotateSelectionWithPin, specifies the X-position of the pin about which the selection is to be rotated.
PinY Optional Double When RotationType is visRotateSelectionWithPin, specifies the Y-position of the pin about which the selection is to be rotated.
PinUnitsNameOrCode Optional Variant Specifies the units to use for PinX and PinY. See Remarks for possible values. The default is inches.

Return value

Nothing

Remarks

The following possible values for RotationType are declared in VisRotationTypes in the Visio type library.

Constant Value Description
visRotateSelectionWithPin 1 Rotates the selection around a pin.
visRotateSelection 0 Rotates the selection relative to the center of the selection.
visRotateShapes 2 Rotates the selected shapes around their pins relative to their current angle.

Passing True for the optional BlastGuards argument overrides formulas in the ShapeSheet of any of the selected shapes to which the GUARD function has been applied.

The default value for RotationType is visRotateSelection.

You can specify AngleUnitsNameOrCode or PinUnitsNameOrCode as an integer (a member of VisUnitCodes) or a string value such as "radians" or "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 Rotate method to rotate a selection 45 degrees relative to the center of the selection.

Public Sub Rotate_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.Rotate 45, visDegrees 
 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.