3.4. Editing a Powerpoint Macro

In this section, you'll edit a PowerPoint macro. PowerPoint no longer includes a macro recorder, so you'll either have to type in the code for the following example, or, better, just copy it from this book's Web site at: www.sybex.com/masteringvba.

Start by opening the PowerPoint Visual Basic Editor:

  1. Open PowerPoint and in the new, blank presentation that's displayed, add a shape by clicking the Insert tab on the Ribbon, then clicking the Shapes icon in the Illustrations section.

  2. Click a rectangle shape of your choice. This will be object 1 in the Shapes collection, so we can refer to it in the code like this:

    ActiveWindow.Selection.SlideRange.Shapes(1).Select
  3. Open the PowerPoint Visual Basic Editor by pressing ...

Get Mastering VBA for Microsoft Office 2007, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.