Change a picture to a rounded rectangle, set the rounding radius (PowerPoint 2007)
Problem
PowerPoint 2007 allows you to apply various shapes to pictures you've inserted onto your slides. Some of the shapes let you alter the shape using the yellow diamond adjustment handle. For example, the Rounded Rectangle shape lets you change the rounding radius of the corners.
But suppose you want to create a whole series of these and make each one identical. How do you match the rounding radius from one to the next?
As far as we know, there's no way to do it manually, but with VBA you can. Read on ...
Solution
First, set up one picture manually and adjust the yellow handle to give you the amount of corner radius you want.
Then while the picture is selected, run the GetRounding routine below to reveal the amount of rounding you've applied.
Sub GetRounding() Dim oSh As Shape Set oSh = ActiveWindow.Selection.ShapeRange(1) With oSh MsgBox .Adjustments(1) End With Set oSh = Nothing End Sub
Next, select another inserted picture and run the following code after editing it where indicated to enter the rounding value you learned from the previous code:
Sub SetRounding() Dim oSh As Shape Dim sngRounding as Single ' EDIT THIS TO MATCH THE VALUE YOU GOT ABOVE sngRounding = 1.23 Set oSh = ActiveWindow.Selection.ShapeRange(1) With oSh oSh.AutoShapeType = msoShapeRoundedRectangle .Adjustments(1) = sngRounding End With Set oSh = Nothing End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code.