1.3. Recording a Macro

The easiest way to create VBA code is to record a macro using the Macro Recorder, but only some applications support the Macro Recorder. You switch on the Macro Recorder, optionally assign a method for running the macro (a toolbar button or a shortcut key combination), perform the actions you want in the macro, and then switch off the Macro Recorder. As you perform the actions, the Macro Recorder translates them into commands — code — in the VBA programming language.

Once you finish recording the macro, you can view the code in the Visual Basic Editor and change it if necessary. If the code works perfectly as you recorded it, you never have to look at it — you can just run the macro at any time by choosing the assigned ...

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.