OL97: Q&A: Questions about Customizing or Programming Outlook

Last reviewed: March 2, 1998
Article ID: Q170783
The information in this article applies to:
  • Microsoft Outlook 97

SUMMARY

This article answers some of the more commonly asked questions about creating custom Microsoft Outlook 97 forms or programming Outlook either through Microsoft Visual Basic Scripting Edition (VBScript) or Visual Basic for Applications Automation.

MORE INFORMATION

 1. Q. Where do I get started programming Outlook?

    A. For more information about available resources for learning how to
       program with Outlook 97, please see the following article in the
       Microsoft Knowledge Base:

          ARTICLE-ID: Q166368
          TITLE     : OL97: How to Get Help Programming with Outlook

 2. 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 into the folder or forms library where you
       will use it. On the custom form's 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 from the shortcut
       menu, click Properties. In the "When posting to this folder, use:"
       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
       basically tells Outlook which form to use to display the item. You
       cannot directly change this field from an Outlook dialog box (since
       it is considered read-only), but you can use VBScript or Automation
       code to accomplish this.

       For more information about changing the message class of an item
       in a folder, please see the following articles in the Microsoft
       Knowledge Base:

          ARTICLE-ID: Q170301
          TITLE     : OL97: How to Update Existing Items to Use a New
                      Custom Form

          ARTICLE-ID: Q169431
          TITLE     : OL97: Word 97 Document to Change Outlook Folder
                      Message Class

 3. 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 hide the default form page, but you may lose
       some functionality, as described in the answer to the next question.

       For more information about this subject, please  see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q160303
          TITLE     : OL97: First Tab of Custom Form Cannot Be Modified

 4. 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 dropdown control are not
       available. How come?

    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 execute. 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 more information about this issue, please see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q165949
          TITLE     : OL97: Calendar Control Not Available to VBScript

 5. Q. How can I disable the macro warning dialog?

    A. If the form is not located in a trusted location, then Outlook
       will display the macro warning dialog for your protection against
       potentially maliciously-written programming code, commonly called
       macro viruses.

       For more information about this issue, please see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q166780
          TITLE     : OL97: Why Outlook Displays a Security Warning Opening
                      an Item

 6. Q. I created a custom form and it looks great, but when I close
       and then re-open the item, or when I send the form to someone
       else, all of the information I entered into my custom controls
       is gone. How come?

    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:

          ARTICLE-ID: Q168975
          TITLE     : OL97: How to Use Fields and Controls with VBScript

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

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

          ARTICLE-ID: Q168095
          TITLE     : OL97: How to Automate Outlook from Another Program

          ARTICLE-ID: Q170262
          TITLE     : HOWTO: Use OLE Automation with Microsoft Outlook 97

          ARTICLE-ID: Q161012
          TITLE     : ACC: Using Automation to Run Microsoft Outlook

 8. Q. Why do some items in a folder have different icons? Or, why do some
       of the items in the folder have an abnormally large size? Or, how
       come I am running into situations where the Message Class of the
       item is changing back to the default Message Class? Or, I would like
       to get a better understanding of how forms really work in Outlook.

    A. For more information about these questions, please see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q176567
          TITLE     : OL97: Working with Form Definitions and One-Off Forms

 8. Q. How do I modify some sample code that uses one type of folder when
       I need it to work with another type of folder? Or, how do I
       programmatically create a new item or reference an existing item?

    A. For more information about working with folders and items, please
       see the following article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q180696
          TITLE     : OL97: Programming Examples for Referencing Items
                      and Folders

 9. Q. I am trying to do something, but do not seem to be able to find
       any information on how to do it. Is it possible?

    A. Outlook does not support a "full" object model, such as those in
       Microsoft 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 a
       desired approach in creating a solution.

       For more information about some of the more common things that
       cannot be done with custom forms, VBScript, or Outlook Automation,
       please see the following article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q172752
          TITLE     : OL97: Outlook 97 Object Model Limitations

10. 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. If you
       are familiar with Visual Basic programming, however, you can create
       a solution that programmatically imports or exports the information.

       For more information about this issue, please see the following
       articles in the Microsoft Knowledge Base:

          ARTICLE-ID: Q161295
          TITLE     : OL97: Cannot Import or Export User-defined Contact
                      Fields

          ARTICLE-ID: Q170320
          TITLE     : OL97: How to Programmatically Import Outlook Items
                      from Access

11. Q. How do I set a default form for my Inbox?

    A. There is no direct way of doing this, but a workaround is to publish
       the message form to the folder, and then create a new mail item by
       choosing the form at the bottom of the Compose menu.

       For more information about this issue, please see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q161586
          TITLE     : OL97: Cannot Change the Default Mail Message Form

12. Q. How come some of the examples in the VBAOUTL.HLP file do not work?

    A. For more information about this issue, please see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q169751
          TITLE     : OL97: Errors in Outlook Visual Basic Help
                      (Vbaoutl.hlp)

13. Q. How do I populate the "From" field on a message form?

    A. You must use the SentOnBehalfOfName property of the item, and
       not the olOriginator constant from the Recipients collection. This
       property is not read-only as the Vbaoutl.hlp file says.

       For more information about this issue, please see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q168022
          TITLE     : OL97: How to Set a Form's From Field Using VBScript

14. Q. How can I programmatically work with the Message area of a form?

    A. The key limitation when programmatically setting or changing the
       body of a message is that you can't format the text of the message.
       Any changes done using code will be in plain text since the body
       property is treated like any other field. There is no added
       functionality that supports using rich text format (RTF). Also, the
       naming convention may seem confusing, since the field name in the
       Field Chooser is "Message", whereas programmatically, the property
       of the item is "Body."

       For more information about this issue, please see the following
       articles in the Microsoft Knowledge Base:

          ARTICLE-ID: Q172755
          TITLE     : OL97: Working With the Message or Body of an
                      Outlook Item

          ARTICLE-ID: Q162995
          TITLE     : OL97: VBScript Cannot Access Characters in the
                      Body Property

15. Q. How come when I use a custom control on my Outlook form, none of the
       events appear to work?

    A. 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, create a Visual Basic 5.0 ActiveX
       component (formally called an OLE server application). You start the
       component by using the CreateOject method in Outlook's object model.
       The component would display a VB 5.0 form with the appropriate
       controls, get 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
       on how to create an ActiveX component, please see your documentation
       for Visual Basic 5.0.

16. Q. I am programmatically adding an e-mail name in a contact item, but
       the e-mail address isn’t automatically resolved and therefore the
       contact isn't 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 email address
       is added programmatically, the name doesn't automatically get
       resolved.

       For more information about this issue, please see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q169750
          TITLE     : OL97: How to Programmatically Resolve a Contact's
                      E-mail Address

17. Q. When I retrieve appointment (Calendar) items and the folder has
       recurring appointments, how come the only item retrieved is the
       initial appointment?

    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 more information about this issue, please see the following
       articles in the Microsoft Knowledge Base:

          ARTICLE-ID: Q170789
          TITLE     : OL97: How to Retrieve All Recurring Appointments
                      with Code

          ARTICLE-ID: Q171115
          TITLE     : OL97: How to Use the Restrict Method

18. Q. How can I sign or seal a message from VBScript or Outlook
       Automation?

    A. This is currently not possible through the Outlook object model or
       the Active Messaging object model (MAPI.Session).

       For more information about this issue, please see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q168889
          TITLE     : OL97: Cannot Programmatically Sign or Seal a Mail
                      Message

19. Q. How can I tell what version of VBScript a computer is using?

    A. You must check the file dates or version of the VBScript DLL files.

       For more information about this issue, please see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q167138
          TITLE     : OL97: General Information About Using VBScript
                      with Outlook

20. 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 perhaps
       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 more information about this issue, please see the following
       article in the Microsoft Knowledge Base:

          ARTICLE-ID: Q168784
          TITLE     : OL97: Custom Field Values Lost When Sending Request
                      Form

21. 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:

          ARTICLE-ID: Q163769
          TITLE     : OL97: How to Start Another Program from an Outlook
                      Form

          ARTICLE-ID: Q175515
          TITLE     : OL97: How to Display a Web Page in an Outlook Form

22. Q. Why doesn't Outlook support Visual Basic for Applications?

    A. Outlook's use of VBScript is by design. VBScript is designed
       for use in "distributed" or "enterprise" applications such as
       Outlook and Microsoft Internet Explorer. Because VBScript
       is a fully interpreted programming language, it takes relatively
       little space to store VBScript code. This is important for an
       application like Outlook, which is routinely used to send custom
       forms -- with code -- across a corporate network or internet
       connection. Also, VBScript does not include some Visual Basic for
       Applications commands, such as Declare or Shell, making it a more
       secure programming environment, which is also important for
       applications that transfer code from person to person.


Additional query words: FAQ OutSol OutSol97

Keywords : kbinterop kbprg
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.