PowerPoint’s grow or shrink effect slowly increases and decreases an object right before your eyes, which is a nice effect. But what if you just want to click the object and presto chango, increase or shrink it? PowerPoint doesn’t offer an animation for that, but you can still do it with a little VBA magic.
The technique for increasing and decreasing the size of an AutoShape is simple. The hardest part is deciding how much to grow or shrink your object. In this example, I’ll provide two procedures-one that increases the size of an object and a second that shrinks the same object. Click once, the shape’s bigger, click again, and it’s smaller.
First, you’ll need to insert an AutoShape into a blank slide-just use any basic shape. Then, launch the Visual Basic by Editor (VBE) by pressing [Alt]+[F11]. In the VBE, open a module by choosing Module from the Insert menu, and enter the following code:
Sub GrowShape(myShape As Shape)
'Increase the size of clicked object.
myShape.Height = myShape.Height * 1.5
myShape.Width = myShape.Width * 1.5
myShape.ActionSettings(ppMouseClick).Run = "ShrinkShape"
'Center object.
With ActivePresentation.PageSetup
myShape.Left = (.SlideWidth \ 2) - (myShape.Width \ 2)
myShape.Top = (.SlideHeight \ 2) - (myShape.Height \ 2)
End With
End Sub
Sub ShrinkShape(myShape As Shape)
'Decrease the size of clicked object.
myShape.Height = myShape.Height / 1.5
myShape.Width = myShape.Width / 1.5
myShape.ActionSettings(ppMouseClick).Run = "GrowShape"
'Center object.
With ActivePresentation.PageSetup
myShape.Left = (.SlideWidth \ 2) - (myShape.Width \ 2)
myShape.Top = (.SlideHeight \ 2) - (myShape.Height \ 2)
End With
End Sub
Now you need to connect the procedures to clicking the AutoShape, as follows:
- Click the Insert tab. In the Links group, click the Action option. In PowerPoint 2003, choose Hyperlink from the Insert menu.
- In the resulting dialog, click the Run Macro option.
- From that option’s dropdown, choose GrowShape. (You can choose either macro, depending on the original size of the shape.)
- Click OK.
Now you’re ready to run the show by pressing [F5] to see how it works. First, PowerPoint displays the original shape. To increase the size, click it. Be sure you click the shape and not the slide. (If you move to the next slide, you’ll know that you didn’t click the shape.)
Clicking the shape executes the GrowShape procedure that you just linked to. This procedure increases the width and height by half. The next line resets the shape’s mouse click action to ShrinkShape. Clicking the shape again will execute ShrinkShape, which decreases the size of the object. Both procedures contain the same With block, which centers the shape after resizing.
These two procedures are generic enough to handle most any shape. The downloadable demo contains three different shapes that all link to the same set of procedures. You’ll want to test it thoroughly to make sure the increased size fits on the slide of course. You can change the increase and decrease dimensions to suit your needs. Centering the resized shape is simple; an offset requires a bit more work.