PDA

View Full Version : Return to initial position after giving IncrementRotation to shape



papuapu
06-23-2021, 11:04 PM
Sir,

I have a octagonal shape & I give some IncrementRotation to it. Now I want to go its previous position(ie before using IncrementRotation). But I canot configure out in vba.
Need some help.

Below I give "IncrementRotation 22" but if I forget that value(22) then how can I do ?

Sub RotateShape()
Dim osld As Slide
Dim j As Integer
Dim hshp As Shape


Set osld = ActivePresentation.Slides(1)
For j = 1 To 4
Set hshp = osld.Shapes("octagon" & j)
hshp.IncrementRotation 22
Next j




End Sub

John Wilson
06-24-2021, 06:57 AM
Maybe store the start rotation in a Tag


Sub RotateShape()
Dim osld As Slide
Dim j As Integer
Dim hshp As Shape
Set osld = ActivePresentation.Slides(1)
For j = 1 To 4
Set hshp = osld.Shapes("octagon" & j)
hshp.Tags.Add "INC", hshp.Rotation
hshp.IncrementRotation 22
Next j
End Sub


Sub reset_Rotation()
Dim osld As Slide
Dim j As Integer
Dim hshp As Shape
Set osld = ActivePresentation.Slides(1)
For j = 1 To 4
Set hshp = osld.Shapes("octagon" & j)
hshp.Rotation = hshp.Tags("INC")
Next j
End Sub