Share via

Macros Samples

The Macros IDE includes some sample macros for your study and use. They are located in a node called Samples and are available in either the Macro Explorer or the Macros IDE. The following is a list of the macro samples and a description of what they do.

Provided Samples

  • Accessibility — Contains macros that are used to manipulate the text and display property size and appearance in the Visual Studio.

  • AddDirAsSlnFolder — Imports a folder on disk into a solution folder structure.

  • DevStudio6Editor — This macro project contains macros from the Developer Studio version 6.0 macros sample that have been converted to work in Visual Studio macros. It illustrates how to print all open documents, comment a selected block of code, add revision marks, and more.

  • MakeAddin — Converts a macro project into a Visual Studio Add-in. This project illustrates the structure of an Add-in, how to iterate through all of the projects in a macro and each item in a project, how to use the ItemOperations object to add new project items, how to copy references from one project to another, and more.

  • Utilities — Contains several utility macros that are used by the other sample macros. It illustrates how to save and retrieve window configurations, how to manipulate properties in the Options dialog box, how to iterate through items in a project, and more.

  • VSDebugger — Contains a number of macros that use the Debugger automation model objects to control and manipulate debugging operations. It illustrates how to list the stack in the Command window for each thread running in the current program, list and manipulate breakpoints, list processes and languages supported by the debugger, and more.

  • VSEditor — Creates a notepad-like text editor in Visual Studio, complete with editor functionality such as cut and paste, insert, and so forth. It illustrates how to save a backup of the current document, use the Code automation model to create and manipulate outlined sections, how to navigate through code, how to move and use the insertion point, how to manipulate and format text, and more.


    A module called EnvironmentEvents is also present in the Sample macro, but EnvironmentEvents is not really a sample; it is there to provide event handlers for other macros. It does illustrate, however, how event handlers are initialized in macros. For more information about this, see How to: Handle Environment Events in Macros.

See Also


How to: Edit and Programmatically Create Macros


Automating Repetitive Actions by Using Macros


Overview of the Macros IDE

Add Macro Project Dialog Box