Share via


Macro Files

Home Page (Macros)OverviewHow Do I TopicsFAQReference

Visual C++ stores macros in text files called macro files. A macro file has a .DSM file extension and can contain one or more macros. The number of macros is up to you.

You install macro files from the Add-ins and Macro Files tab of the Customize dialog box (Tools menu, Customize command). Once installed, they load automatically whenever you start Visual C++. They are available to all projects, but they are independent of projects.

At the beginning of each macro file is a description of the file. You provide this description when you create the file. Following this description are the macro definitions.

Before you start writing or recording a macro, Visual C++ appends a macro stub to the file. This stub begins with a Sub statement containing the macro's name, continues with a description that you provide, and ends with an End Sub statement.

A macro's VBScript commands go between its Sub and End Sub statements. If you write the macro by hand, you must insert these commands. However, if you record the macro, Visual C++ automatically inserts the commands where they belong.

Sub MacroName()
'Description: The macro description goes here

'TODO: The VBScript commands go here

End Sub