Link to home
Start Free TrialLog in
Avatar of Eric Shen
Eric Shen

asked on

Resizing every other graphic

Hi,

I am working on a 3000 power point slide where there is one image per slide.  I would like to re-position all the odds slides one way, and all the even slides another.   This is what i have so far:

Sub repodd()
Dim I As Long
Dim opic As Shape
Dim osld As Slide

With ActivePresentation.Slides
    For I = 1 To .Count
        If I Mod 2 = 1 Then
    For Each opic In osld.Shapes
        If opic.Type = msoPicture Then
            With opic
                .LockAspectRatio = msoFalse
                .Top = 1.99 * 72
                .Left = 0.2 * 72
            End With
        End If
    Next I
    Next opic
    Next osld
End With
       
End Sub

This unfortunately is not working.  Was wondering if I could get a fresh pair of eyes.  I'm a very big novice to VBA but very interested to learn more.  

Follow Up: I believe if I wanted to do even slides, I would just change this line:  If I Mod 2 = 1 to  If I Mod 2 = 0.  Correct?
Avatar of John Wilson
John Wilson
Flag of United Kingdom of Great Britain and Northern Ireland image

Try this

Sub repodd()
   Dim opic As Shape
   Dim osld As Slide
   For Each osld In ActivePresentation.Slides
      If osld.SlideIndex / 2 = osld.SlideIndex \ 2 Then      'even
         For Each opic In osld.Shapes
            If opic.Type = msoPicture Then
               With opic
                  .LockAspectRatio = msoFalse
                  .Top = 1.99 * 72
                  .Left = 0.2 * 72
               End With
            End If
         Next opic
      Else
         'odd
      End If
   Next osld
End Sub
ASKER CERTIFIED SOLUTION
Avatar of John Wilson
John Wilson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Eric Shen
Eric Shen

ASKER

Thanks so much! Worked like a charm