• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Recording a VBA Macro

By far the easiest way to create a command macro is to use the Macro Recorder. With this method, you start the recorder and then run through the task you want to automate (including selecting text, running menu commands, and choosing dialog box options). The Recorder translates everything into the appropriate VBA statements and copies those statements to a command macro in a module. You can then use the recorded macro to replay the entire procedure any time you like. This section shows you how to record a command macro in Word, Excel, or PowerPoint. (The other programs in the Office suite don’t have macro recording capabilities.)

To begin, set up the application so that it’s ready to record. In Word, for example, if you want to record a series of formatting options, select the text you want to work with. When that’s done, either select Tools, Macro, Record New Macro or click the Record Macro button in the Visual Basic toolbar. You’ll see the Record Macro dialog box appear. Figure 11.2 shows the Excel version.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint