toggle between different alignments of pictures by means of VBA
Dear Experts:
below macros allow me to align pictures on the slides of the active presentation.
Thank you again to JRS Wilsion for that. Now I would like to tweak that code even more.
The user should be able to press a toggle button to toggle between different alignments.
The first code lets the user align all the pictures on all the slides of the active presentation vertically and horizontally centered
The second code lets the user align the pictures on all the slides of the active presentation horizontally centered but the vertical alignment is '.Top = 180'
The third code lets the user align the pictures on all the slides of the active presentation horizontally centered but the vertical alignment is '.Top = 250'
As a matter of fact, I got no idea how to combine these codes so that repeated pressing of the macro button toogles between these different states of alignment. I hope this is not asking too much.
Help is much appreciated. Thank you very much in advance.
Regards, Andreas
Sub ResizeAndPosition_Pictures_ToggleButton_1()' pictures horizontally and vertically centeredDim i As IntegerDim oshp As ShapeDim oshpR As ShapeRangeFor i = 1 To ActivePresentation.Slides.CountFor Each oshp In ActivePresentation.Slides(i).ShapesIf oshp.Type = msoPlaceholder ThenIf oshp.PlaceholderFormat.ContainedType = msoPicture Thenoshp.ScaleHeight 0.7, TrueSet oshpR = ActivePresentation.Slides(i).Shapes.Range(oshp.ZOrderPosition)oshpR.Align msoAlignCenters, TrueoshpR.Align msoAlignMiddles, TrueEnd IfElseIf oshp.Type = msoPicture Thenoshp.ScaleHeight 0.7, TrueSet oshpR = ActivePresentation.Slides(i).Shapes.Range(oshp.ZOrderPosition)oshpR.Align msoAlignCenters, TrueoshpR.Align msoAlignMiddles, TrueEnd IfEnd IfNext oshpNext iEnd Sub
thank you very much for your swift and professional support. Both your solutions are workable and will come in handy in other circumstances.
As a matter of fact I am looking for a solution where all three of the above codes get integrated just in one using the SELECT CASE Statement. I have worked with SELECT CASE statements in Word und Excel but for some reason I cannot get this one working with the codes above.
thank you very much for your swift and professional support. Both your solutions are workable and will come in handy in other circumstances.
As a matter of fact I am looking for a solution where all three of the above codes get integrated just in one using the SELECT CASE Statement. I have worked with SELECT CASE statements in Word und Excel but for some reason I cannot get this one working with the codes above.
Regards, Andreas