Microsoft Office Online
Sign in to My Office Online (What's this?) | Sign in

Warning: You are viewing this page with an unsupported Web browser. This Web site works best with Microsoft Internet Explorer 6.0 or later, Firefox 1.5, or Netscape Navigator 8.0 or later. Learn more about supported browsers.

Email this linkEmail this link Printer-Friendly VersionPrinter-Friendly Version Bookmark and ShareShare
Automate your form
 

You can automate a form by saving macros (macro: An action or a set of actions that you can use to automate tasks. Macros are recorded in the Visual Basic for Applications programming language.) in the form (form: A document that contains fill-in blanks, or form fields, in which you enter information. For example, you can create an online registration form in Microsoft Word that uses drop-down lists from which users can select entries.) template (template: A file or files that contain the structure and tools for shaping such elements as the style and page layout of finished files. For example, Word templates can shape a single document, and FrontPage templates can shape an entire Web site.). The macros can run automatically when the insertion point enters or exits a form field (form field: In a form, a location where a particular type of data, such as a name or address, is stored.). For example, if a user selects a Married check box, an exit macro can activate other related fields, such as Name of Spouse.

Note  This procedure applies to forms whose controls (control: A graphical user interface object, such as a text box, check box, scroll bar, or command button, that lets users control the program. You use controls to display data or choices, perform an action, or make the user interface easier to read.) you inserted by using the Forms toolbar (toolbar: A bar with buttons and options that you use to carry out commands. To display a toolbar, press ALT and then SHIFT+F10.).

  1. Open the template that contains the form you want to change.
  2. Remove protection from the form template by clicking Protect Form Button image on the Forms toolbar.
  3. Create the macros you want to use, and store them in the form template.

    If another template contains macros you want to use, copy them into the form template.

    Security  Use caution when you are adding macros to your form. Macros may be designed in such a way that their use could pose a security risk. We recommend that you use macros from trusted sources only.

  4. Double-click the form field you want to assign a macro to.
  5. To run a macro when the insertion point enters the form field, click the macro in the Entry box.

    To run a macro when the insertion point exits the form field, click the macro in the Exit box.

Note  If you store the entry and exit macros in your Normal template and then distribute a form to others, the entry and exit macros may not run because the macros won't be available to the users. You must store the macros that you use in the form in the form template.

© 2009 Microsoft Corporation. All rights reserved.