Word Wizards

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Microsoft® Word includes several wizards that are installed optionally; the Letter wizard, the Memo wizard, and the Résumé wizard are a few examples. These files have the extension .wiz, but they are Word templates. You can open them in Word and view their VBA projects.

To create an application-specific wizard for Word, first create a Word template that contains any boilerplate text, plus the wizard forms and code. The wizard should include code that displays a form as soon as the user launches the wizard.

Next, determine how users will launch the wizard. If they will launch the wizard from a command bar control, you can add the control programmatically from code running in a Word add-in.

To design a wizard that is launched from a command bar control

  1. Add the AutoExec procedure to a standard module in the wizard's project, and include the code to create the control in that procedure.
  2. In the code that creates the control, set the control's OnAction property to the name of a procedure in the wizard project that displays the starting form for your wizard.
  3. Add the AutoExit procedure, and include code to remove the control when the wizard is unloaded, so the user does not see the control unless the wizard is loaded.
  4. Load your wizard as an add-in.

If the user will launch the wizard by creating a new document, you are not required to have a command bar control, nor the AutoExec nor AutoExit procedures.

To design a wizard that is launched by creating a new document

  1. In the wizard's VBA project, open the ThisDocument module.
  2. Create the Document_New event procedure by clicking Document in the Object box and New in the Procedure box.
  3. Within this event procedure, call the procedure that displays the wizard's starting form.
  4. Copy the wizard template to the C:\Windows\Application Data\Microsoft\Templates folder, or if user profiles are being used, to the C:\Windows\Profiles\UserName\Application Data\Microsoft\Templates folder, and change the file's extension to .wiz. Confirm this change when Windows prompts you to do so.

When users create a new document by clicking New on the File menu, they will see your wizard displayed in the New dialog box. Clicking the wizard and then clicking OK creates a new document and runs the Document_NewEvent procedure, which displays the wizard's starting form.

See also

Creating Wizards | Common Characteristics of Wizards | Excel Wizards | PowerPoint Wizards | Access Wizards | Loading a Word Add-in