| < Day Day Up > |
|
In some cases, you might want an action the user selects to execute a macro you've added to the form. You can add a macro to your form template just as you would add a macro to any other document. Here are the steps:
Open the template to which you want to add the macro.
Click the field you want to use, and click Protect Form on the Forms toolbar to unprotect the field.
Double-click the field to display its Form Field Options dialog box.
Select the macro you want to use by making a choice in the Run Macro On section of the dialog box as follows:
If you want the macro to execute when the user enters, or selects, the field, click the Entry arrow and choose the macro you want to use from the list. The macros displayed in the list are those that are available in the document you are currently using. (For more information on adding macros to your form, see Chapter 32, "Creating and Working with VBA Macros.")
If you want the macro to execute after the user exits, or deselects, the field, click the Exit arrow and choose the macro from the list, as shown in Figure 31-17.
Figure 31-17: Choose whether you want Word to execute a macro when the user accesses or exits the field.
Click OK to close the Form Fields Options dialog box and save the settings.
Click the Protect Form button to protect the form once again. The macro is now enabled and will execute according to your selections when the user accesses the field.
Troubleshooting: I don't have any macros in the Entry or Exit lists
If you can't locate the macros you want to add, the trouble could be that you haven't added those macros to the current form. To add a macro to the current document, follow these steps:
Choose Tools, Templates And AddIns. The Templates And AddIns dialog box appears.
Click Organizer.
Click the Styles tab.
Click Close File on the left side of the dialog box; then click Open File, select the name of the file containing the macro you want to use, and then click Open.
Select the macro you want to use in the list on the left and click Copy. The item is placed in the list on the right side of the dialog box.
Click Close to save the change and return to the document.
| < Day Day Up > |
|