Share via


Create a macro

When you create a new macro, you launch the Microsoft Visual Basic Editor to write your Visual Basic for Applications (VBA) macro code.

Note

You cannot "record" a macro in Microsoft Expression Web, but the Help in the Visual Basic Editor has sample code that you can copy and paste into your macros to automate common tasks.

To create a new macro

  1. On the Tools menu, point to Macro, and then click Macros.

  2. In the Macro name box, type a name for the macro, and then click Create. Macro names cannot contain spaces or punctuation marks, but you can use underscores. For example, you can use Macro1 or Macro_1, but not Macro 1.

  3. In the Visual Basic Editor, type or copy your code into the module window.

  4. If you want to run the macro from the module window, press F5.

  5. When you finish creating your macro, on the File menu, click Close and Return to Microsoft Expression Web.

You can get information about macro creation and debugging, as well as information about the Expression Web object model, in the Visual Basic Editor help.

To get Visual Basic Editor help

  • On the Help menu in the Visual Basic Editor, click Visual Basic Help.

See also

Concepts

Macros overview

Run, edit, or debug a macro