views:

97

answers:

1

This code creates a string of 10 slides, in which each next slide's 2 shapes (number 1 and number 3) are nudged a bit in relation to similar shapes in the previous slide, while one shape (number 2) remains in the same position throughout.

Each nudge is equal to 2 points (pixels?), but I wonder how could I modify this code so that each nudge would be greater than the previous one by one point. For example, the nudge for creating slide 2 would be 2 points, but the nudge for slide 3 will be 3 points, etc.

Sub MovingFlanks()
    Dim oPresentation As Presentation
    Set oPresentation = ActivePresentation
    Dim oSlide As Slide 
    Dim oSlides As SlideRange
    Dim oShape As Shape
    Dim slideNumber As Integer
    For slideNumber = 1 To 10
        Set oSlide = oPresentation.Slides(oPresentation.Slides.Count)
        oSlide.Copy
        Set oNewSlides = oPresentation.Slides.Paste()
        Set oSlide = oNewSlides(1)
        Set oShape = oSlide.Shapes(1)   
        For Each shapeNum In Array(1, 3)
            Set oShape = oSlide.Shapes(shapeNum)
            oShape.Left = oShape.Left + 2 
        Next shapeNum
    Next slideNumber
End Sub
+3  A: 

Just replace:

oShape.Left = oShape.Left + 2

...with:

oShape.Left = oShape.Left + slideNumber

(although you might want to use slideNumber * 10 to make it noticeable).

Gary McGill
Thank you, Gary!!!
brilliant