Consulting

Results 1 to 2 of 2

Thread: Return to initial position after giving IncrementRotation to shape

  1. #1
    Banned VBAX Regular
    Joined
    Sep 2020
    Location
    https://t.me/pump_upp
    Posts
    15
    Location

    Return to initial position after giving IncrementRotation to shape

    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

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    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
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •