Recording Macros

The best way to get started with macros is to record one. You don’t have to write any code or invoke any arcane VBA spells. You simply start the recorder, click the same menus and press the same keys you always do, and then stop the recorder.

Recording a macro is like working a crossword puzzle in pen; your mistakes are indelibly saved along with what you got right. If you make a mistake, you have to rerecord the macro until you get it 100 percent right. So before you record a macro, take some time to figure out what you want to record. Then practice the steps a couple of times. (Write up a cheat sheet if you’re recording more than a few steps.)

Before you start recording, make sure you perform any preliminary steps that you don’t want to record in the macro—like opening a specific Project file or applying a view. In addition, the Project file must contain values that let you record all the steps you’ve planned. For example, if you’re recording a macro that sorts tasks by their variances, then the Project file must have a baseline set (Setting a Baseline).

Now you’re ready to record:

  1. In the View tab’s Macros section, click MacrosRecord Macro.

    The Record Macro dialog box opens, as shown in Figure 24-1.

  2. In the “Macro name” box, type a short name with no spaces, like LongCriticalTasks.

    You can’t include spaces in a macro name. If you want to separate words, insert underscores (_) between them or capitalize the first letter in each word Camel case actually means the first ...

Get Microsoft Project 2013: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.