Outlook Programming: Custom forms & disabling the macro warning?

This issue happens 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.

In detail, outlook always prompts you before opening an item that contains VBScript code if the item is from an unknown source. This methodology ensures that unsafe VBScript code cannot run on your computer without your explicit approval. Outlook bases the decision to display or not display a warning on the item's form design and where script, and the accompanying form definition, is actually stored.

  • If the form has been published in one of the forms libraries (organizational, personal, or folder), Outlook considers the form safe, and no warning appears. The author of the form had the appropriate privileges to publish the form, so the form is considered trusted.
  • If the VBScript code and form definition is carried within the item, Outlook considers the form unsafe, and the user receives a warning when opening the item

Ideally, when you design a forms solution, you should avoid having the VBScript warning message appear. Additionally, you do not want the custom code to be automatically disabled. If you are using a custom mail message form and you are also using Outlook in a Microsoft Exchange Server environment, ideally you should publish the form into the Organizational Forms Library so that it is available to all users within the organization. In addition to not having the warning appear, another benefit is that the form definition is not routed from user to user, which can save considerable network and server resources.

If you are using a "non-routed" form, such as a contact or post form, the form should typically be published into the folder which will store the items that are based on the form. For example, if you are creating a custom contact form that will be used to store shared contacts in an Exchange public folder, the form should be published in that public folder. One exception to this general rule is if you will be using the same custom form in many folders. In this case it may be advisable to publish the form to the Organizational Forms Library so there is only copy of the form to maintain.