![]() |
|
||||
Using Outlook to Create FormsExchange Forms Designer - a Predecessor Outlook predecessor was the Exchange client application. It was not
as rich as Outlook, but there was something coming with it that simplified
creation of forms. It was called Exchange Forms Designer. It is a client
application, as well as Exchange client itself. To install it you need
the Exchange client disk, navigate to its Eng/Efdsetup subdirectory and
run the Setup.exe from there. Exchange Forms Designer is using 16 bit Visual
Basic to perform its tasks. I am mentioning it here for historical reasons
to eliminate possible confusion about what tool should you use to design
forms. As Exchange is the predecessor of Outlook, so is Exchange Forms
Designer the predecessor of Outlook built-in capability to design forms.
Exchange Forms Designer keeps its form definitions in files with .efp extensions.
Capabilities of Exchange Forms Designer are poorer than that of Outlook.
For example, you can't add a button on a form and associate code with it
(it is possible, however, when using 16 bit Visual Basic 4.0 directly on
form files). You should consider using Outlook instead.
About Outlook Forms Perhaps the most dramatic advantage of Outlook in regards to forms is its capability to create, install and run forms. You can design a form in a kind of a Visual Studio graphical environment by putting controls on a form, associating properties and code (VBScript) with them. Outlook provides powerful functionality, which allows for creation of usable MAPI forms in a matter of days instead of months. This comes with its price, though. Performance is one aspect here. Also, Outlook forms are only a subset of all possible forms. For example, you would not be able to create something like the Checkers form. Visual interface elements are limited to edit boxes, buttons, and some other common elements. Code should be written in VBScript. Everything is event driven. For example, it is easy to associate code with an event such as opening or closing the form, but impossible to create something like a timer which is automatically invoked every interval. In spite of all these limitations the opportunity is powerful and in many cases this would be just enough. Outlook comes with its own file format for forms. A form description can be saved in a file with .oft extension (abbreviated from Outlook form template). You can take a look at contents of such files. Usually they are located in the Templates subdirectory of Microsoft Office installation. Also, implementation details of Outlook form servers are different from raw MAPI form servers. For example, one of message attachments for a raw MAPI form is a form server executable file (you can examine the Checkers form attachment to see this). In case of Outlook forms the number of attachments is 4 instead of 3. Also, an attachment that appears to represent a form server has a .tmp extension. A lot of things that you normally see in Outlook are forms. When you compose a new message you fill out the Message form. When you create a new contact you do it by invoking the Contact form. Some of the forms such as the Message form are one page dialogs. Others such as the Contact form have multiple pages. Outlook comes with a few predesigned forms. They are: Message, Post in a folder, Appointment, Meeting Request, Contact, Task, Task Request, Journal Entry and Note. You may explore their possibilities by navigating to File - New menu list. Conceptually, each form is designed for a well defined purpose. The Message form creates an outgoing message, the Note creates a memo note and so on. You can modify an existing form or design your own by removing all controls
from an existing one and starting all over from scratch. You can add controls
such as buttons to a form and even associate Visual Basic scripts with
them. Everything including writing scripts is done within Outlook environment.
Some standard easy tasks such as rearranging controls, introducing custom
properties, associating them with controls, etc. may be accomplished even
without any programming at all, by just using the possibilities of the
rich Outlook client program.
Installing Outlook Forms Help You may find it useful to install the Outlook Forms Help Add-In to your Outlook client. This is a rich collection of documents describing how one may use Outlook forms. Once installed, you would see the "Microsoft Outlook Forms Help" item on the "Help" menu, which navigates you to the help files. To install, download the Olfrmhlp.exe file from http://support.microsoft.com/support/kb/articles/q161/0/82.asp.
Alternative ways of getting the Olfrmhlp.exe file are listed in the
following MSDN article:
Creating Simple Outlook Forms: Suppose we need to create two simple custom forms. I'll call them the Status Update Request and the Status Update. They are supposed to work together. A manager who wants a status update from an employee sends a Status Update Request to the employee. The employee hits the Reply button. This action invokes the Status Update form, which the employee may fill out and send to the manager. To create the Status Update Request form do the following:
Let's add a trivial VBScript code to the form. For the sake of simplicity I am going to demonstrate here a very trivial form. I want my form to have one additional button. Pressing this button should invoke a Win32 MessageBox operation. By demonstrating this I hope to give you an idea how an Outlook form may interact with the operating system via Visual Basic script. Create a button on a form in the way I have described above. Write Visual Basic script for the click event by going to Form - View Code and typing in the following: Sub CommandButton1_Click
Clicking the CommandButton1 on the form will now invoke a standard message
box.
|