Incorporating Form Macros

 < 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:

  1. Open the template to which you want to add the macro.

  2. Click the field you want to use, and click Protect Form on the Forms toolbar to unprotect the field.

  3. Double-click the field to display its Form Field Options dialog box.

  4. 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.

      click to expand
      Figure 31-17: Choose whether you want Word to execute a macro when the user accesses or exits the field.

  5. Click OK to close the Form Fields Options dialog box and save the settings.

  6. 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

start example

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:

  1. Choose Tools, Templates And AddIns. The Templates And AddIns dialog box appears.

  2. Click Organizer.

  3. Click the Styles tab.

  4. 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.

  5. 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.

  6. Click Close to save the change and return to the document.

end example



 < Day Day Up > 



Microsoft Office Word 2003 Inside Out
Microsoft Office Word 2003 Inside Out (Bpg-Inside Out)
ISBN: 0735615152
EAN: 2147483647
Year: 2005
Pages: 373

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net