Recording a Macro

This task explains how to record a macro from a dialog sequence.

Note: you cannot record a macro involving the Tools->Options->Shareable tab.

You can store the recorded macro in the current document or in a file. Even if you choose to store the macro in a file, if a document was current when you began to record the macro, a link is created in this document to the file storing the macro, and the macro can afterwards be selected and run using this link from the document. If you want to record a macro that is not pointed to by any document, you need to store the macro in a file, and you can either start recording with no current document, or delete the created link from the current document when the macro is recorded.
  1. Select the Tools->Macro->Start Recording... command.

 

This displays the Record Macro dialog box:

 

 
  1. Specify the current macro library or document.

This means deciding where the macro is going to be stored:

  • in a macro library: the macro will be stored in a directory (or a VBA project if it exists)
  • in a document: the macro will be stored in the current document.

What macro types you can store and where you can store them are summarized in the following table:

 

Where Stored
Language Used Editor File Extension In Document In Directory In VBA Project
CATScript (Basic Script) Default or external .CATScript Yes Yes No
VB Script (Visual Basic) Default or external .catvbs Yes Yes No
VBA Visual Basic Editor only .catvba No No Yes
 

Opening the list for this option displays the following by default:

 

 

By default, the only macro library library available is your E: folder. You can also choose to store the macro in the current document (a CATProduct document in our example).

 
  1. Click the Macro libraries... button if you want to add, create or remove macro libraries.

The Macro libraries dialog box appears:

 

 

Only the E: folder is available because you have not yet created any other macro libraries.

 
  1. Click the Library type field to display the following:

 

 

The choices are:

  • All libraries: displays all directories and VBA projects
  • Directories: displays only directories
  • VBA projects: displays only VBA projects.
 
  1. Click the Add existing library... button and navigate to select the library or VBA project, or click the Create new library... button and create the new macro directory of VBA project, and provide names when prompted.

You can also select a library from the list then click the Remove selected library button to delete it.

 
  1. Make sure the Language used: option is set to the desired language.

 
  1. Provide a name for the macro.

  1. Click Start to begin recording the macro.

A Warning box is displayed if the macro already exists. Click Yes to start recording the macro while overriding the existing one. The dialog boxes related to the macro recording disappear and the Stop Recording dialog box appears.

  1. Perform the dialog sequence you want to record.

  1. When this is complete, click Stop in the Stop Recording dialog box, or select the Tools->Macro->Stop Recording command. Your macro is now ready for replay.