How to: Manage Macros

Macro Explorer is your primary tool for tracking and managing macros. It is a window in the main Visual Studio integrated development environment (IDE) and can be viewed by pressing ALT+F8. For details about the various parts of Macro Explorer, see Macro Explorer Window.

The primary tasks associated with managing macros are:

  • Creating new macro projects and modules.

  • Loading and unloading existing macro projects.

  • Deleting macro projects and modules.

  • Renaming macro projects, modules, and commands.

  • Editing a command or module

You can save macros as either binary or text files. Binary is the default format for macros and uses the .Vsmacros extension. You can also choose, however, to save the macro as Unicode text (.txt).

Saving a macro as a binary file makes it convenient to distribute several macros in a project as a single file. Saving a macro as a text file enables you, for example, to open the file outside of Visual Studio, copy a single command from it, and then e-mail it to someone.

By default, macros are stored in \VSMacros80 in the directory specified by the Visual Studio Projects Location text box in the Projects and Solutions node of the Options dialog box on the Tools menu of the Macros IDE. You can, however, change the Visual Studio project location path in the Options dialog box, or press CTRL+E to export the macro to another location.

Macro Management

For all of the following tasks, press ALT+F8 to display Macro Explorer if it is not already displayed.

To create a new macro project or module in the Macro Explorer

  1. To create a new macro project, right-click the Macros node and choose New Project.

  2. To create a new macro module, right-click a project and choose New Module.

To load an existing macro project in the Macro Explorer

  1. Right-click the Macros node and choose Load Project.

  2. Browse to the macro project file and then choose Open.

To unload a macro project from the Macro Explorer

  • Right-click the macro project you want to unload and choose Unload Project.

    Note

    When a project is unloaded, its security settings are lost. For more information, see Macros Security and Sharing Issues.

To delete a macro module or command from Macro Explorer

  1. Select the item and press DELETE.

    —or—

  2. Right-click it and choose Delete.

    Note

    Delete the project file by using Windows Explorer.

To delete a macro project from Macro Explorer

  • Right-click it and choose Unload.

    Note

    Delete the project file by using Windows Explorer.

To rename a macro project, module, or command

  1. To rename a macro project, module, or command, right-click it and choose Rename.

  2. Type the new name and press ENTER.

    Note

    Renaming modules affects module declarations in files, but renaming projects does not affect the default namespace. Also, if you rename a macro project, module, or command in the Macros IDE, the changes will not be reflected in Macro Explorer or Project Explorer. Macro references are still based on the namespace declared in the modules, which can compile errors if you attempt to refer to macros based on the new project name.

For information about how to edit a macro module or command, see How to: Edit and Programmatically Create Macros.

See Also

Tasks

How to: Record Macros

How to: Run Macros

How to: Reference COM and .NET Framework Components in Macros

How to: Handle Environment Events in Macros

Concepts

Automating Repetitive Actions by Using Macros

Debugging Macros

Macro Recording and Running Issues