Home Page (Macros) | Overview | How Do I Topics | FAQ | Reference
You can write a VBScript macro manually by adding the code for the macro to a new or existing macro file.
To write a macro by hand
-or-
To add the macro to an existing file, select the file name in the Macro File box. If the name is not in the list, first install the file, then select it in the Macro File box.
Note You cannot create a new macro in a read-only file, but you can browse an existing macro in a read-only file.
Visual C++ opens the macro file, creates a Sub
block (macro stub) for the new macro at the end of the file. For example, if the macro name were MyMacro, the Sub
block would look like:
Sub MyMacro()
'Description: The macro description goes here.
'TODO: Insert the macro code here.
End Sub
Tip It is good practice to declare variables used in a macro. You declare variables by using the VBScript Dim statement. You can be sure to declare variables before using them by adding the line, "Option Explicit" at the beginning of a macro file. For more information about the VBScript language, see the VBScript reference.
See Also Recording VBScript Macros