Running VBScript Macros

Visual Studio 6.0

Home Page (Macros)OverviewHow Do I TopicsFAQReference

After installing a macro file, you can run the macros it contains. The easiest way to run them is to use the toolbar buttons or key sequences assigned to the macros.

Note   While a VBScript macro is running, the Visual C++ user interface does not respond to mouse clicks or keystrokes. This design prevents unchecked program actions from being processed between macros, but may give the appearance that the user interface is frozen while processing a lengthy macro.

You can also run macros from the Macros dialog box (Tools menu, Macro command) or the command line.

To run a macro from the Macros dialog box

  1. On the Tools menu, click Macro.

  2. In the Macro File box, select the file containing the macro you want to run. If this file is not in the list, first install the file, then select it in the Macro File box.

  3. In the Macro Name box, double-click the name of the macro you want to run.

    -or-

    Select the macro's name and then click the Run button.

To run a macro from the command line.

  • Type msdev –ex Command

    where Command is the name of the macro. This syntax starts Visual C++, and after the Visual C++ main window appears, the macro starts running.

    After the macro completes, Visual C++ continues running. If you want Visual C++ to end, then the macro must call the Application object's Quit method when it completes.

    Additionally, you can run a macro according to a schedule. The following table shows how to schedule a macro with Windows NT or Windows 95.

    To schedule a macro Do this
    With Windows NT Use the AT command to run

    msdev –ex Command

    For example, to run the macro "MyMacro" at 1:00 A.M, use the command:

    AT 1:00am "msdev -ex MyMacro"

    The AT command is available only with Windows NT.

    With Windows 95 If you have the Plus Pack, use the System Agent to run

    msdev –ex Command


Visual C++ provides other ways of using toolbar buttons and key sequences to customize your desktop environment. For details, see Customizing Visual C++.

Show: