OL2000: Questions About Custom Forms and Outlook Solutions

ID: q146636


The information in this article applies to:


SUMMARY

This article provides resources and answers some of the more commonly asked questions about creating custom solutions using Outlook forms and other Outlook programming technologies, such as Visual Basic for Applications and Visual Basic Scripting Edition (VBScript).

Topics are categorized in the following areas:

Resources
Items and Outlook Custom Forms
Visual Basic for Applications, COM Add-ins, and Automation
The Outlook Object Model


MORE INFORMATION

Resources

Microsoft Outlook Visual Basic Reference Help
Microsoft Office Developer Web Forum
Microsoft Exchange Server Collaboration
Third-party Web Sites
VBScript
MSDN Online
Internet Newsgroups
Microsoft Press
Microsoft Product Support Services
Solution Providers

Microsoft Outlook Visual Basic Reference Help

Primary documentation for creating Outlook solutions is provided in the Microsoft Outlook Visual Basic Reference (Vbaoutl9.chm), which is installed by Microsoft Office or Outlook Setup. This file contains information about forms, fields, controls, the Outlook object model, and a general overview of VBScript, Visual Basic for Applications, and COM add-ins. It also summarizes all of the new developer-related features in Outlook. If you customize Outlook frequently, consider placing a shortcut to Vbaoutl9.chm on your desktop or Windows Start menu.

Microsoft Office Developer Web Forum

This Microsoft Web site provides a wide variety of information about building solutions based on Microsoft Office. The site is updated frequently and is located at:

http://msdn.microsoft.com/OfficeDev

Microsoft Exchange Server Collaboration

This Microsoft Web site provides a wide variety of information about building solutions on Exchange. The site is updated frequently and is located at:

http://www.microsoft.com/exchange/Collaboration.htm

Microsoft Knowledge Base

Consult the Microsoft Knowledge Base for up-to-date information about issues related to creating Outlook solutions. Many how-to articles are also included. To make finding articles easier, most articles related to custom Outlook solutions contain the query term OutSol2000. The Web site is located at:

http://http://support.microsoft.com/support/search/c.asp?

Third-Party Web Sites

The following third-party Web sites provide information about creating Outlook solutions:

Outlook and Exchange Developer Resource Center
(formally the USEast Outlook Developers Site)
http://www.OutlookExchange.com
Slipstick Systems Exchange Center
http://www.slipstick.com

VBScript

Outlook 2000 includes VBScript version 5.0 as the scripting language for forms-based solutions. The Microsoft Scripting Web site provides frequently asked questions, sample code, language documentation, and free downloads for people using the VBScript language. The Scripting Web site is available at:
http://msdn.microsoft.com/scripting/

MSDN Online

If you are developing enterprise-level solutions that involve Exchange or Office, you should consult various Exchange and Messaging documentation that is available at the Microsoft Developer Network Library site:
http://msdn.microsoft.com/library/default.htm

Internet Newsgroups

Peer-to-peer newsgroups are available to help you interact with other Outlook users. You can use any newsreader software to access these newsgroups. The Microsoft news server name is msnews.microsoft.com. The newsgroups related to Outlook solutions include program_forms, program_vba, and program_addins. Information about all Microsoft newsgroups is available at:
http://support.microsoft.com/support/news

Microsoft Press Books

Building Applications with Microsoft Outlook 2000
Microsoft Press (ISBN 1-57231-718-3)
This book will be available sometime in June. Building Applications with Microsoft Outlook 98, by Microsoft Press, is still available at major book sellers and from Microsoft Press Online.

Programming Microsoft Outlook and Microsoft Exchange
Microsoft Press (ISBN 0-7356-0509-2)
Available from Microsoft Press Online

For general information on offerings by Microsoft Press, call Microsoft Press at (800)MSPRESS, or consult the Microsoft Press Web site at:
http://mspress.microsoft.com

Microsoft Product Support Services

Microsoft provides a complete range of support options for Outlook customers. For more information about where to get direct support for developing solutions with Outlook, please see the following article in the Microsoft Knowledge Base:

Q198354 OL2000: Getting Support for Developing Outlook-related Solutions

Solution Providers

For information about Solution Providers in your local area, contact the Microsoft Solution Provider Sales and Information line at (800)765-7768 in the US or (800)563-9048 in Canada. For information about support in other locations, contact a local Microsoft subsidiary.

Items and Outlook Custom Forms

Specifying a Form for an Item
Macro Warning When Opening Item
Data Lost When Using Form
User-Defined Fields Overview of One-off Forms
Importing Custom Fields
Overview of Control Events
Printing Forms
Starting Other Applications

Q: I have created a custom form for my Contacts, Tasks, and so on, but it is not being used when I create a new item, when I open an existing item I had before I created the form, or when I create a new item. Why is my form not being used?

A: To use a custom Outlook form, there are three steps you need to complete.

First, publish the form in the folder or forms library where you will use it. On the custom form File menu, click Publish Form. The name of the form is also the Message Class, which is important for the next two steps.

Second, make this new form the default form for that folder. Using your right mouse button, click the folder and on the shortcut menu, click Properties. In the When posting to this folder, list, click to select your custom form. Now new items that you create will use the custom form instead of the default Outlook form.

Third, if you have any existing items in the folder that should use this new form, you must change the Message Class field in each of the items in the folder. The Message Class field of an item tells Outlook which form to use to display the item. You cannot directly change this field from Outlook since it is considered read-only, but it is possible use programming code and the Outlook object model to change the field.

For more information about changing the message class of an item in a folder and utilities to help you do this, please see the following articles in the Microsoft Knowledge Base:

Q201087 OL2000: How to Update Existing Items to Use a New Custom Form
Q201089 OL2000: Word Document to Change Message Class of Outlook Items

Q: How can I disable the macro warning when someone opens an item?

A: If the form is not located in a trusted location, such as the Organizational Forms Library on the Exchange Server, then Outlook will display the macro warning for your protection against potentially malicious programming code, commonly called macro viruses. There is no direct way to prevent the warning from appearing, you must publish the form to a trusted location. For more information about this issue, and other reasons why you may receive this warning, please see the following article in the Microsoft Knowledge Base:

Q207913 OL2000: Why Outlook Displays a Security Warning Opening an Item

Q: I created a custom form and it looks great, but when I close and then open the item again, or when I send the form to someone else, all of the information I entered into my custom controls is gone. Why does this happen?

A: In Outlook, controls on a form are used to display information, but the information is actually stored in fields. Therefore, in order for the values of the controls to be preserved, the control must be bound to an Outlook standard or user-defined field. For more information about this issue, please see the following article in the Microsoft Knowledge Base:
Q207430 OL2000: How to Use Fields and Controls with VBScript

Q: User-defined fields aren't working the way I expect. How come?

A: User-defined fields offer great flexibility in how data is structured within a folder, but this flexibility can also provide some challenges for solution developers. For more information about using user-defined fields in Outlook, please see the following article in the Microsoft Knowledge Base:
Q201438 OL2000: Working With User-defined Fields in Solutions

Q: Why do some items in a folder have different icons? Why do some of the items in the folder have an abnormally large size? Why does the Message Class of an item change back to the default Message Class? How can I get a better understanding of how forms work in Outlook?

A: Understanding the difference between forms and items and how the two relate to each other is important when designing an Outlook solution. In most scenarios, forms are published to a location and then linked to the items in the folder. However, it is possible that forms can be stored within individual items, and this can cause Outlook behavior to change in various circumstances. For more information about form definitions and how they relate to items, please see the following article in the Microsoft Knowledge Base:

Q207896 OL2000: Working with Form Definitions and One-Off Forms

Q: When importing contacts from an external database, how do I map some of the fields to the user-defined fields that I have set up in a custom contact form?

A: This is a limitation of the Outlook Import and Export Wizard. There is no way to directly import data into user-defined fields. If you are familiar with Visual Basic programming, you can create a solution that programmatically imports or exports the information. For more information about this issue and an example of importing data from Microsoft Access into Outlook user-defined fields, please see the following articles in the Microsoft Knowledge Base:
Q197654 OL2000: Cannot Import or Export User-defined Fields
Q208232 OL2000: Programmatically Import Outlook Items From MS Access

Q: When I use a control on a custom Outlook form, how come none of the control events appear to work?

A: When using a custom Outlook form, Outlook only supports the Click event for controls. Many controls are specifically designed to work with other events, and since these events are not supported by Outlook, the controls may not function in Outlook.

To work around this situation, you can create a Visual Basic ActiveX component (formally called an OLE server application). You start the component by using the CreateObject method in VBScript. The component displays a Visul Basic form with the appropriate controls, gets the information that the user selects or types, and then automates Outlook to send any necessary information back to the Outlook form.

This technique involves many aspects of programming. For information on how to create an ActiveX component, please see the documentation for Microsoft Visual Basic.

For more information about control events on Outlook custom forms, please see the following articles in the Microsoft Knowledge Base:
Q231169 OL2000: Click Event Behavior for Standard Controls

Q: Can I print forms WYSIWYG? Can can I generate reports?

A: There is no direct way to print forms WYSIWYG. Also, the Outlook object model does not provide more printing functionality is provided by Outlook itself. Sometime in the near future, an ActiveX control will be available to enable WYSIWYG form printing, but in the meantime, the best approach to creating custom printouts is to automate another program and use it as a report-generating tool. For more information about this issue and a basic example of how to create a printout using Microsoft Word, please see the following article in the Microsoft Knowledge Base:
Q230512 OL2000: Outlook Does Not Print Forms as Expected

Q: How can I start another program or display a Web page from an Outlook form?

A: You can use the CreateObject method in VBScript to automate an OLE-aware application.

For more information about this issue, please see the following articles in the Microsoft Knowledge Base:
Q206719 OL2000: How to Start Another Program from an Outlook Form
Q231927 OL2000: How to Display a Web Page in an Outlook Form

VBA, COM Add-ins and Automation

Visual Basic for Applications vs. VBScript?
Visual Basic for Applications vs. a COM add-in?
Recording Macros
Getting Started with Automation
Managing and Distributing Visual Basic for Applications Projects
Outlook Hangs Using COM Add-in

Q: I don't understand. VBScript? Visual Basic for Applications? Which is it?

A: Outlook custom forms still use VBScript as they did in previous versions. However, Outlook now provides support for Visual Basic for Applications at the application-level, meaning that you can run macros from the main Outlook toolbars or menus and that code can function outside the scope of an item. Most of the additions to the Outlook object were added to support this new application-level programming model. For example, there are many new events that allow custom code to run when certain things happen in Outlook, such as when you recieve new mail, or if the user selects a different item in a folder. Your code can run much like a batch process, where you click a toolbar button and a macro retrieves data from a folder and then updates information in a public folder.

Q: COM add-ins also give me the ability to create application-level code. So when should I use a COM add-in, and when should I use Visual Basic for Applications?

A: Visual Basic for Applications in Outlook was designed primarily to create personal solutions. It allows you to quickly create a solution to fit your needs. COM add-ins are typically the better choice if you wish to distribute your solution. However, COM add-ins generally require a greater investment in development time.

Q: How can I record macros?

A: While Outlook now includes Visual Basic for Applications, the Outlook object model does not provide functionality that supports recording macros.

Q: How do I get started automating Outlook from another program?

A: For information on automating Outlook from another program, please see the following article in the Microsoft Knowledge Base:

Q201096 OL2000: How to Automate Outlook from Another Program

Q: Where is my Visual Basic for Applications project stored? How to I distribute a solution I created to other people?

A: For information on using Visual Basic for Applications projects in Outlook, please see the following article in the Microsoft Knowledge Base:

Q229911 OL2000: Managing and Distributing Outlook Visual Basic for Applications Projects

Q: My COM add-in causes Outlook to hang. What could be going wrong?

A: Your COM add-in may be causing a Visual Basic run-time error to occur, and this may be causing a problem with Outlook. Due to a limitation in COM add-ins, you should use error trapping throughout your COM add-in code to trap any potential run-time errors. For information on this issue, please see the following article in the Microsoft Knowledge Base:

Q208316 OL2000: All Potential COM Add-in Run-Time Errors Should be Trapped

The Outlook Object Model

Object Model Limitations
Referencing Items and Folders
Finding Items in a Folder
Working with Collections
ShowFormPage/HideFormPage Changes
Address Books

Q: I am trying to do something but it doesn't seem possible. Is it?

A: Outlook does not support a full object model, such as those in Word or Excel, so what you are trying to do may not be possible. Also, there may be other Outlook design considerations or limitations that may prevent you from using a desired approach in creating a solution.

For more information about some of the more common things that cannot be done within Outlook solutions, please see the following article in the Microsoft Knowledge Base:

Q208527 OL2000: Common Outlook Object Model Limitations

Q: How do I programmatically refer to a particular Outlook folder or a particular item? How do I create a new folder or item?

A: Outlook provides a variety of ways to programmatically access and maniuplate items and folders. For more information about working with folders and items, please see the following article in the Microsoft Knowledge Base:
Q208520 OL2000: Programming Examples for Referencing Items and Folders

Q: How do I programmatically search for items and folder based on the contents of a field?

A: You can use the Find method to retrieve a single item based on the contents of one or more fields. Or, you can use the Restict method to retrieve a set of items that match certain criteria. For more information about using the Find and Restrict methods, please see the following article in the Microsoft Knowledge Base:
Q201081 OL2000: Using Find and Restrict to Retrieve Items

Q: I'm having problems working with a collection of objects, what might be the cause?

A: The following Microsoft Knowledge Base articles summarize the most common problems developers have when working with collections. In addition, a collection may not be updated until an item is saved, so if you find that a collection is not in the proper state, try saving the item to force Outlook to update the collection. For more information about working with collections, please see the following articles in the Microsoft Knowledge Base:
Q222481 OL2000: How to Properly Reference Members of a Collection
Q222482 OL2000: How To Handle Unexpected Items in a Collection
Q222480 OL2000: How to Delete Items in a Collection

Q: I created a solution in Outlook 97 or Outlook 98 that uses the ShowFormPage and HideFormPages methods in the Outlook object model, but it doesn't behave the same in Outlook 2000. Why?

A: In Outlook 97 and Outlook 98, using the ShowFormPage and HideFormPage methods caused the item to become a one-off item. This behavior was changed in Outlook 2000 and using these methods no longer result in the form definition being stored within the item. Unfortunately, this improvement may have an impact on some older solutions where VBScript code depends on the form pages being saved in a certain state. For more information about this change, please see the following article in the Microsoft Knowledge Base:
Q218618 OL2000: ShowFormPage, HideFormPage No Longer Create One-Off Item

Q: How can I integrate address books with my solution?

A: For a top-level overview of working with address books in a custom solution, please see the following article in the Microsoft Knowledge Base:
Q231290 OL2000: Using Address Books in an Outlook Solution

Additional query words: FAQ OutSol OutSol2000 vbscript


Keywords          : kbdta 
Version           : WINDOWS:2000
Platform          : WINDOWS 
Issue type        : kbhowto 


Last Reviewed: May 26, 1999
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.