Frequently asked questions about custom forms and Outlook solutions

Article translations Article translations
Article ID: 146636 - View products that this article applies to.
This article was previously published under Q146636
Expand all | Collapse all

On This Page

SUMMARY

This article provides resources and answers to commonly asked questions about creating custom solutions by 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:

MORE INFORMATION

Resources

There are a variety of resources that are available to help you develop Outlook solutions. For more information about where to find these resources, click the following article number to view the article in the Microsoft Knowledge Base:
271225 Resources for custom forms and programming in Outlook 2000

Items and Outlook Custom Forms

Q: I have created a custom Outlook form, but it is not used when I create a new item or when I open an existing item that I had before I created the form. Why is my form not used?

A: To use a custom Outlook form in a typical folder-based form solution, there are three steps that you need to complete:
  1. Publish the form in the folder or forms library where you want to use it. On the Tools menu in the custom form, point to Forms, and then click Publish Form. The name of the form is also the Message Class, which is important for the next two steps. If you are not sure where to publish the form, click the article number below to view the article in the Microsoft Knowledge Base:
    257796 How to determine where to publish a form
  2. Make this new form the default form for that folder. To do this, right-click the folder, and then click Properties. In the When posting to this folder box, click your custom form, and then click OK. New items that you create may use the custom form instead of the default Outlook form.
  3. If you have any existing items in the folder that you want to use this new form, 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 in Outlook because it is considered read-only, but you can use programming code and the Outlook object model to change the message class of the field. For additional information about how to change the message class of items in a folder and utilities to help you do this, click the following article number to view the article in the Microsoft Knowledge Base:
    201087 How to update existing items to use a new custom form

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

A: If the form is not located in a trusted location, such as the Organizational Forms Library on an Exchange Server-based computer, Outlook displays the macro warning message to protect you from potentially malicious programming code, commonly called macro viruses. You cannot directly prevent the warning message from appearing; you must publish the form to a trusted location. For additional information about this issue and other reasons why you may receive this warning message, click the following article number to view the article in the Microsoft Knowledge Base:
207913 Why Outlook displays a security warning message or does not run VBScript Code when you open an item

Q: I created a custom form, but when I close and then open the item again, or when I send the form to someone else, all of the information that 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, for the values of the controls to be preserved, the control must be bound to an Outlook standard or user-defined field. For additional information about this issue, click the following article number to view the article in the Microsoft Knowledge Base:
207430 How to use fields and controls with VBScript

Q: User-defined fields are not working the way that I expect them to work. Why?

A: User-defined fields offer flexibility in how data is structured within a folder, but this flexibility can also provide some challenges for solution developers. For additional information about how to use user-defined fields in Outlook, click the following article number to view the article in the Microsoft Knowledge Base:
201438 Working with user-defined fields in solutions

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

A: Understanding the difference between forms and items and how the two relate to each other is important when you design an Outlook solution. In most scenarios, forms are published to a location and then linked to the items in the folder. However, you can store the forms in individual items, and this can cause the behavior of Outlook to change in many ways. For additional information about form definitions and how they relate to items, click the following article numbers to view the articles in the Microsoft Knowledge Base:
207896 Working with form definitions and One-off forms
238765 Some control properties create One-off forms

Q: When I import or export contacts from an external database, how can 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 or export 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 additional information about this issue and examples of how to import or export user-defined fields, click the following article numbers to view the articles in the Microsoft Knowledge Base:
197654 Cannot import or export user-defined fields
208232 How to programmatically import Outlook items from Microsoft Access
253794 How to programmatically export items to Microsoft Access

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

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

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

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

For additional information about control events on Outlook custom forms, click the following article number to view the article in the Microsoft Knowledge Base:
231169 Click Event behavior for standard controls

Q: Can I print forms as they appear on the screen?

A: There is no direct way to print forms as they appear on the screen. Also, the Outlook object model does not provide more printing functionality than that which is provided by Outlook itself. To work around this limitation, you can either use another program to print Outlook information, or you can download a ActiveX control or Outlook extension to create a custom form printing solution. For additional information about how to create custom form printing solutions, click the following article number to view the article in the Microsoft Knowledge Base:
230512 Outlook does not print forms as expected

Q: Can I design a form in Outlook 2000 and use it with previous versions of Outlook?

A: This is generally not a good idea. To help ensure compatibility, design the form by using the earliest version of Outlook that uses the form.

Q: How can I change the default mail message form? I have tried to change the default form for my Inbox, but I receive an error message.

A: If you want to change the default form that is used for all items of a specific type, you need to use a utility that enables Outlook to substitute a custom form for one of the default forms. However, you can only use this utility with Outlook 2000. For additional information about this utility and how to obtain it, click the following article number to view the article in the Microsoft Knowledge Base:
241235 Utility available to change default Outlook forms
If you want to change the default form for a specific folder but you cannot do it, there is a work around that enables you to indirectly set any type of form as the default form for a folder. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
249199 How to set any form as the default form for a folder

Q: How can I get option buttons to work on an Outlook form?

A: You need to follow specific steps in order for option buttons to function in Outlook.

Q: What is the forms cache? Why does Outlook use it? How does it work?

A: The forms cache is an integral part of how Outlook works with forms. As a forms developer, it is important to have a general understanding about how the forms cache works so that you can troubleshoot potential issues that may occur. For additional information about the forms cache, click the following article number to view the article in the Microsoft Knowledge Base:
232303 How the forms cache works

Q: How can I manipulate the Message or Notes field on a form?

A: If your mail format is set to Outlook Rich Text format, Outlook provides limited support for manipulating the body of a message. However, if you use Hypertext Markup Language (HTML) format or Microsoft Word as your e-mail editor, you can create highly formatted e-mail messages. For additional information about working with the body of an item, click the following article number to view the article in the Microsoft Knowledge Base:
201105 Working with the message or body of an Outlook item

Q: There are many steps to open a form from the Organizational Forms Library or Personal Forms Library. How can I add a form to a toolbar button to make this easier?

A: You need to create custom Visual Basic for Applications code or a COM add-in to do this. For additional information about how to do this, click the following article number to view the article in the Microsoft Knowledge Base:
231174 How to open a form from a Toolbar button

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 program. For additional information about this issue, click the following article numbers to view the articles in the Microsoft Knowledge Base:
206719 How to start another program from an Outlook form
231927 OL2000: How to Display a Web Page in an Outlook Form

VBA, COM Add-ins, and Automation

Q: What is the difference between VBScript and Visual Basic for Applications, and which one should I use?

A: Outlook custom forms use Visual Basic Scripting Edition (VBScript) as they did in previous versions of Outlook. 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 of the scope of an item. Most of the additions to the Outlook object model were added to support this new application-level programming model. For example, there are many new events that enables custom code to run when certain things happen in Outlook, such as when you receive new mail, or if the user clicks a different item in a folder. Your code can also 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: Visual Basic for Applications and COM add-ins both give me the ability to create program-level code. Which one should I use?

A: Visual Basic for Applications in Outlook was designed primarily to create personal solutions. The main advantage to using Visual Basic for Applications in that you can quickly create a solution to fit your needs. COM add-ins are typically the better choice if you want to distribute your solution. However, COM add-ins generally require a greater investment in development time. Also, if you need to develop a COM add-in, it is often easier to develop and debug the solution by using Visual Basic for Applications. Then, when the Visual Basic for Applications code is functioning as you want it to, you can typically move the code into the COM add-in framework with very few changes.

Q: How can I record macros?

A: Although Outlook now includes Visual Basic for Applications, the Outlook object model does not provide functionality that supports recording macros. For additional information about not being able to record macros, click the following article number to view the article in the Microsoft Knowledge Base:
234690 Unable to record macros in Outlook

Q: How can I get started integrating Outlook into another program?

A: You can use automation to programmatically control Outlook from another custom program. For additional information about automating Outlook, click the following article number to view the article in the Microsoft Knowledge Base:
201096 How to automate Outlook from another program

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

A: Outlook Visual Basic for Applications code is stored in a single file called VBAproject.otm, and Outlook Visual Basic for Applications is not designed to be distributed. For additional information about how to use Visual Basic for Applications projects in Outlook, click the following article numbers to view the articles in the Microsoft Knowledge Base:
229911 Managing and distributing Outlook Visual Basic for Applications projects
224874 Code does not work after you distribute a Visual Basic for Applications Project

Q: How can I get started developing a COM add-in?

A: For additional information about how to develop COM add-ins, click the following article number to view the article in the Microsoft Knowledge Base:
230225 How to create a COM add-in for Outlook

Q: My COM add-in causes Outlook to stop responding (hang). What could be 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. Because of this limitation of COM add-ins, use error trapping throughout your COM add-in code to trap any potential run-time errors. For additional information about this issue, click the following article number to view the article in the Microsoft Knowledge Base:
208316 All potential COM add-in run-time errors should be trapped

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

A: Your COM add-in is most likely not releasing Explorer or Inspector objects, and this causes Outlook to not quit. For additional information on this issue, click the following article number to view the article in the Microsoft Knowledge Base:
208332 You cannot fully quit Outlook when you use a COM add-in

The Object Model and Other General Questions

Q: Before I start to develop a solution, how can I find out if someone has already developed something that I am planning?

A: The Slipstick Systems Web site provides a comprehensive summary of add-ins and utilities. For more information about these add-ins, view the following Slipstick Web site:
http://www.slipstick.com/addins/index.htm
The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Q: What effect can the Outlook E-mail Security Update have on solutions that I develop?

A: As a developer, you should fully understand the implications of the Outlook E-mail Security Update. For additional information about the security update and links to other resources that are related to the update, click the following article number to view the article in the Microsoft Knowledge Base:
262701 Developer information about the Outlook E-mail Security update

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

A: Outlook provides many ways to programmatically access and manipulate items and folders. For additional information about how to work with folders and items, click the following article number to view the article in the Microsoft Knowledge Base:
208520 OL2000: Programming examples for referencing items and folders

Q: Why can I not figure out how to do something? Is it possible?

A: Outlook does not support a full object model, such as those in Word or Microsoft 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 the approach that you want to create a solution. For additional information about this, click the following article number to view the article in the Microsoft Knowledge Base:
266428 Custom forms and programming limitations

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

A: You cannot programmatically use the Find or Advanced Find features in Outlook, but you can use the Find method in the Outlook object model to retrieve a single item based on the contents of one or more fields. You can also use the Restrict method to retrieve a set of items that match certain criteria. For additional information about how to use the Find/ and Restrict methods, click the following article number to view the article in the Microsoft Knowledge Base:
201081 Using Find and Restrict to retrieve items

Q: I am having problems working with a collection of objects, what is the cause of this problem?

A: There are three common scenarios that Outlook developers have problems with when they work with collections in the Outlook object model. Because collections, especially the Items collection, are in integral part of the Outlook object model, you should be familiar with these issues. For additional information about how to avoid potential problems when you use collections, click the following article numbers to view the articles in the Microsoft Knowledge Base:
222481 How to properly reference members of a collection
222482 How to handle unexpected items in a collection
222480 How to delete iItems in a collection

Q: How can I generate reports based on data that is stored in Outlook?

A: There are a few approaches that you can take:
  • Import the data into another program and use that program's report generating capabilities. Microsoft Access is typically the best program to use because you can use the Link Exchange/Outlook Wizard in Access. However, this wizard does not support user-defined Outlook fields and some of the Outlook standard fields. If you require additional fields that the wizard does not support, you must create custom code to transfer the data from an Outlook folder into an Access table.
  • Automate another program from Outlook to generate a report. You can do this by using VBScript in an Outlook form, Visual Basic for Applications, or a COM add-in.
  • Use a third-party tool to generate reports. One available utility is Business Objects Crystal Reports. For more information about this utility, view the following Business Objects Web site:
    http://www.businessobjects.com/products/reporting/crystalreports/default.asp

Q: What is the best way to create a routing or workflow solution in Outlook?

A: Creating a custom Outlook form solution is typically not the best approach to implement a routing or workflow solution. If you are not familiar with designing custom Outlook forms, implementing this type of solution is often more complex than it appears. For additional information about what to consider if you want to implement a routing solution, click the following article number to view the article in the Microsoft Knowledge Base:
252976 Overview of implementing workflow or routing solutions

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

A: The Outlook object model does not provide a way to display an address book dialog box, but you can access most address book information. If you require more functionality that the Outlook object model provides, the Collaboration Data Objects (CDO) object model most likely provides the functionality that you require. For additional information about how to work with address books in a custom solution, click the following article number to view the article in the Microsoft Knowledge Base:
231290 Using address books in an Outlook solution

Properties

Article ID: 146636 - Last Review: March 29, 2007 - Revision: 6.1
APPLIES TO
  • Microsoft Outlook 2000 Standard Edition
Keywords: 
kbfunctions kbforms kbhowto kbprogramming ol20proght KB146636

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com