Skip to content

May 14, 2011

checklist

PowerPoint Changing the Aspect Ratio of Images When Switching Slide Dimensions

As a presenter I have a love-hate relationship with PowerPoint. On the one hand it’s an essential tool to speak at conferences, at the other it’s got to be the dumbest piece of software I’ve ever run into – and I’m counting the “Hello World” applications we all right. So as conferences are starting the transition to 16:9 projectors there’s an annoying little problem. When you transition from a 4:3 format to a 16:9 format by copying your slides in – or changing the slide dimensions of PowerPoint, it ignores the “LockAspectRatio” checkbox on your images and promptly distorts them. This just looks awkward.

You would think a problem like this would have tons of posts about how to fix it since it’s got to be a common thing – but apparently not. So here’s the short of fixing it – if you’re up for some VBA code.

First, you’ll have to customize the Ribbon to include a developer tab – for that you’ll go File-Options-Customize Ribbon. In the right hand side you’re going to check the open checkbox next to developer. From there click the developer tab then the macro tab. Give the macro any name you want and click edit. This will bring you to the VBA editor. In the editor paste in the following:

Sub ResetAspectRatioForAllImagesInDeck()
For Each thisSlide In Application.ActivePresentation.Slides
For Each thisShape In thisSlide.Shapes
Dim passShape As Shape
Set passShape = thisShape
If thisShape.Type = msoPicture Then
ResetAspectRatio passShape
ElseIf thisShape.Type = msoPlaceholder Then
If thisShape.PlaceholderFormat.ContainedType = msoPicture Then
ResetAspectRatio passShape
End If
End If
Next
Next
End Sub

Sub ResetAspectRatio(ByRef thisShape As Shape)
Dim tempHeight As Single
tempHeight = thisShape.Height
thisShape.LockAspectRatio = msoFalse
Call thisShape.ScaleHeight(1, msoTrue)
Call thisShape.ScaleWidth(1, msoTrue)
thisShape.LockAspectRatio = msoTrue
thisShape.Height = tempHeight
End Sub

This will go through the active presentation and process every shape. It will force the shape to be back in aspect ratio. If for some reason you don’t preserve aspect ratio of your pictures this will reset them – but you shouldn’t be messing around with aspect ratios of your photos anyway. Once you have this code in the editor you can go to the ResetAspectRatioForAllImagesInDeck() line and click the “Play” triangle. All of your images will be fixed. You may still want to tweak positioning but at least you won’t have to deal with the images looking like a hall of mirrors.

Recent Posts

Public Speaking