Office development
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Using Visio as a Forms Tool: Automated Forms Example

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.
 

January 2000

Applies to:
   Microsoft Visio 2000

Summary: This article demonstrates how a Visio drawing can be automated to act like a forms package. (3 printed pages)

Download AutomatedForm.exe.


Introduction

The Automated Form demonstration shows how a Microsoft® Visio® drawing can be automated to act like a forms package. This demo allows the user to build forms using custom forms shapes. When the user goes to fill out the form, they can use the TAB key to enter the text of the next form field.

This demonstration also includes two utilities for making a form editable (Creation mode) and lock down a form (User Fill-In mode). This demonstration can be extended to include new form shapes that automatically participate in the tabbing order; it can also be extended to include tie-ins to databases.

Customer Benefits

  • Easy-to-use forms package makes it simple to create forms and fill them out.
  • Automated Forms can be the starting point for more sophisticated, database-integrated forms.

How to Set Up

  1. Drop the templates into the Visio \Solutions directory; you can put the templates under their own directory or under an existing one. The templates and stencil then show up under the Visio New menu and Stencil menu.
  2. Since VBA code provides the tabbing behavior, you must start a new form with one of the templates. The shapes will not exhibit the tabbing behavior unless used with these templates.

To create a new form

  1. There are two templates provided. The first, Automated Form.vst, is used to create a new form. Start with this template.
  2. Drag and drop components from the Automated Form stencil onto the page. Keep track of the z-order (stacking order) of the shapes. The stacking order will determine the tabbing order. Use the Send Forward and Send Backward commands to change the stacking order of shapes.
  3. When done constructing the form: On the Tools menu, click Macros, click ThisDocument, and then click Lock Form. This will prevent further changes and movement of the boxes.
  4. On the File menu, click Save As, and then save the completed form as a Template (.vst) file. Your users can then select this template when they need to fill out a new copy of your finished form.

To fill in a form

  1. Choose a preconstructed form template. (For example, Form.vst is a completed form.)
  2. Highlight the first box by selecting on it.
  3. Type in the value.
  4. Tab to go to the next field.
  5. On the File menu, click Save.

To create a new forms shape

  1. Create a shape as you normally would.
  2. Open up the ShapeSheet and add a user cell named “User.Field” to the User section.
  3. Save the shape

This shape will now be a valid shape to tab to automatically.

To modify an existing form

  1. Open the form template or drawing file.
  2. On the Files menu, click Macros, click ThisDocument, and then click Edit Form.
  3. This will make all the shapes on the page editable
  4. Make the necessary changes.
  5. On the Files menu, click Macros, click ThisDocument, and then click Lock Form. This will prevent further changes and movement of the boxes.
  6. Save the new form.

How It Was Designed

This example shows the use of:

  • The CallThis function within the ShapeSheet
  • ShapeSheet Event section cells
  • VBA automation
  • Typed shape (a shape design pattern)

Using these capabilities, we are able to respond to keystrokes, check to see if a shape is to be included in the tab rotation, and automatically position the focus to the proper shape.

Show:
© 2016 Microsoft