Share via


VBScript Macros

A VBScript macro is a procedure that contains VBScript commands and takes no parameters. A VBScript macro begins with a Sub statement, continues with VBScript commands that represent tasks you want to accomplish, and ends with an End Sub statement.

You create a VBScript macro by recording it or writing it manually. The easiest way to create one is to record it. When you record a macro, the recorder tracks your actions, converts them into VBScript commands, and then inserts the commands into the macro.

When you finish recording the macro, it is stored in a text file known as a macro file. You choose this file before you start writing or recording.

To use a VBScript macro, you run it. If you expect to run it regularly, assign it to a toolbar button or to a key sequence. Then, you can run the macro by simply clicking the button or pressing the keys.