I need to edit/crop sets of pictures in a slide.
I want a system where I display one picture, edit it, then run a macro to "hide" the picture and display the next picture of the set.
I renamed the pictures with this format: "Photo 1", "Photo 2", "Photo 3", ... (Photo & n).
I managed to write a macro that does what I want for the first picture, but then fails from the second picture onward.
Dim oSl As Slide
Dim oSh As Shape
Dim n As Long
With ActiveWindow.Selection.ShapeRange
n = n + 1
If ActiveWindow.Selection.ShapeRange.Name = "Photo " & n Then
ActiveWindow.Selection.SlideRange.Shapes("Photo " & n + 1).Visible = msoCTrue
ActiveWindow.Selection.ShapeRange.Visible = msoFalse
End If
End With
The problem lies in the starting condition with n = n + 1
, because n resets to 0 every time I run the macro.
I am trying to tell Powerpoint that n is the number found in the selected picture's name instead of resetting n to 0 every time.
I also tried using the shape index (since the photos are one after the other), but apparently it's not a good idea since the index is not very "reliable/stable", plus I couldn't find a way to find the index of a shape anyway.
I also tried adding an Else n = n + 1
condition at the end, but I'm guessing (assuming that's a viable option) it needs another step where it tells the macro to return to the starting point. Last time I tried a "loop" it crashed my computer.