OL97: Questions About Customizing or Programming Outlook

Article translations Article translations
Article ID: 170783 - View products that this article applies to.
This article was previously published under Q170783
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

Summary

This article provides resources and answers to commonly asked questions about how to create custom solutions by using Outlook forms, Visual Basic Scripting Edition (VBScript) and Visual Basic for Applications automation.

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 additional information about where to find these resources, click the article number below to view the article in the Microsoft Knowledge Base:
166368 OL97: How to Get Help Programming with Outlook

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 File menu in the custom form, 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:
    264117 OL97: 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, use: box, click your custom form, and then click OK. New items that you create will 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 article number below to view the article in the Microsoft Knowledge Base:
    170301 OL97: 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 article number below to view the article in the Microsoft Knowledge Base:
166780 OL97: Why Outlook Displays a Security Warning Opening 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 article number below to view the article in the Microsoft Knowledge Base:
168975 OL97: 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 article number below to view the article in the Microsoft Knowledge Base:
183352 OL97: 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 article number below to view the article in the Microsoft Knowledge Base:
176567 OL97: Working with Form Definitions and 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 an example of how to import user-defined fields, click the article numbers below to view the articles in the Microsoft Knowledge Base:
161295 OL97: Cannot Import or Export User-Defined Contact Fields
170320 OL97: How to Programmatically Import Outlook Items from 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 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 article number below to view the article in the Microsoft Knowledge Base:
231593 OL97: Click Event Behavior for Standard Controls

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

A: Yes. To help ensure compatibility, you should design a form by using the earliest version of Outlook that uses the form. For additional information about designing forms to use with more than one version of Outlook, click the article number below to view the article in the Microsoft Knowledge Base:
260225 OL97: Designing Custom Forms for Different Versions of Outlook

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 cannot do this with Outlook 97. Outlook 2000, however, does support this functionality. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
161586 OL97: Cannot Change the Default Mail Message Form
If you want to change the default form for only a specific folder but you cannot do it, there is a work around that allows you to indirectly set any type of form as the default form for a folder. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
266331 OL97: How to Set Any Form as the Default Form for a Folder

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

A: The key limitation when programmatically setting or changing the body of a message is that you cannot format the text of the message. Any changes that you make by using code are in plain text format because the Body property is treated like any other text field. There is no added functionality that supports using Outlook Rich Text format. Unlike later versions of Outlook, the Outlook 97 object model does not support functionality related to HTML or WordMail message formats. For additional information about working with the body of an item, click the article numbers below to view the articles in the Microsoft Knowledge Base:
172755 OL97: Working With the Message or Body of an Outlook Item
162995 OL97: VBScript Cannot Access Characters in the Body Property

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 a COM-aware program. For additional information about this issue, click the article numbers below to view the articles in the Microsoft Knowledge Base:
163769 OL97: How to Start Another Program from an Outlook Form
175515 OL97: How to Display a Web Page in an Outlook Form

Q: I am trying to use custom icons for items but they do not seem to be consistent and they change unexpectedly. Why?

A: There are a variety of reasons why custom icons may not seem to work correctly. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
168803 OL97: Custom Form Icon Does Not Display

Q: I am programmatically adding an e-mail name in a contact item, but the e-mail address is not automatically resolved and therefore the contact is not added to the Outlook Address Book. Why?

A: This functionality is built into the Outlook user interface and is not accessed by the Outlook object model, so when the e-mail address is added programmatically, the name is not automatically resolved. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
169750 OL97: How to Programmatically Resolve a Contact's E-mail Address

Q: I created a task or meeting request form with user-defined fields, but when I send the form to someone else, the values in those fields disappear. Why?

A: This is a limitation of Outlook request forms. You can work around this problem by using extra standard fields in the request item or store the information in a label control on a hidden page of the form. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
168784 OL97: Custom Field Values Lost When Sending Request Form

Q: Why can I customize the default pages on the Mail and Post forms, but not Contacts, Tasks, and other forms?

A: This is a limitation of all form types except the message and post forms. You can work around this problem by replicating the fields on a custom form page and hiding the default form page, but you may lose some functionality, as described in the answer to the next question. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
160303 OL97: First Tab of Custom Form Cannot Be Modified

Q: Outlook forms have a lot of "intellisense" built into them. For example, if I type a person's name in a Contact form, Outlook automatically assigns the proper name to the FileAs field. But when I add these fields to my custom form page, these features do not work anymore. Things like the calendar drop-down control are not available. Why?

A: These features are built into the Outlook program and are not actually part of the fields themselves. Therefore, when you use the fields on a custom form page, these actions do not run. It may be possible to write VBScript code to accomplish the same task but, depending on exactly what functionality you are trying to replicate, this may involve a lot of programming effort. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
165949 OL97: Calendar Control Not Available to VBScript

The Object Model and Other General Questions

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 article numbers below to view the articles in the Microsoft Knowledge Base:
168095 OL97: How to Automate Outlook from Another Program
170262 HOWTO: Use OLE Automation with Microsoft Outlook 97
161012 ACC: Using Automation to Run Microsoft Outlook

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: 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 article number below to view the article in the Microsoft Knowledge Base:
180696 OL97: 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 article number below to view the article in the Microsoft Knowledge Base:
172752 OL97: 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 more information about how to use the Find and Restrict methods, click the following article number to view the article in the Microsoft Knowledge Base:
174476 How to use variables with Find and Restrict filters

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.
  • Create a custom solution in another program that automates Outlook and extracts data from a folder.
  • Use a non-Microsoft utility to generate reports. One available utility is Business Objects Crystal Reports. For additional information about this utility, visit the following Business Objects Web site:
    http://www.businessobjects.com/products/reporting/crystalreports/default.asp

Q: When I retrieve appointments and the folder has recurring appointments, the only items retrieved are the initial appointment. Why?

A: You have to set the IncludeRecurrences property of the items collection to True. The default is false, which means that only the original appointment is returned. This is commonly an issue when using the Find or Restrict methods to return a collection of appointment items. For additional information about this issue, click the article number below to view the article in the Microsoft Knowledge Base:
170789 OL97: How to Retrieve All Recurring Appointments with Code

Q: How can I tell what version of VBScript a computer is using? Where is the documentation for VBScript? Why does Outlook not support Visual Basic for Applications?

A: For additional information about VBScript, click the article number below to view the article in the Microsoft Knowledge Base:
167138 OL97: General Information About Using VBScript with Outlook

Properties

Article ID: 170783 - Last Review: October 26, 2013 - Revision: 4.0
Applies to
  • Microsoft Outlook 97 Standard Edition
Keywords: 
kbnosurvey kbarchive kbinfo kbinterop kbofficeprog kbprogramming KB170783

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