Using Macros in the Editor
The Visual Studio .NET code editor fully supports macro recording actions, except for mouse actions. Actions that include use of the Find dialog box (but not incremental search), are also fully recorded.
Macro recording is performed by emitting code against the Editor's rich automation object model, so you can record a macro, use ALT+F11 to display the Macros IDE, and then view the code to learn how to write your own commands for the Editor. For more information, see Automating Repetitive Actions by Using Macros.