Skip to content

Instantly share code, notes, and snippets.

@rdapaz
Created October 18, 2018 16:33
Show Gist options
  • Save rdapaz/df626eb2090b9070f5a862d8d5b0f35e to your computer and use it in GitHub Desktop.
Save rdapaz/df626eb2090b9070f5a862d8d5b0f35e to your computer and use it in GitHub Desktop.
Center all images in a powerpoint slide deck
Public Sub AlignCenterMiddle()
Dim shp As PowerPoint.Shape
For Each Slide In PowerPoint.ActivePresentation.Slides
For Each shp In Slide.Shapes
With shp
sngDefaultSlideWidth = PowerPoint.ActivePresentation.PageSetup.SlideWidth
sngDefaultSlideHeight = PowerPoint.ActivePresentation.PageSetup.SlideHeight
.Left = (sngDefaultSlideWidth - .Width) / 2
.Top = (sngDefaultSlideHeight - .Height) / 2
.ZOrder msoSendToBack
End With
Next shp
Next Slide
Debug.Print ("All done")
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment