Description of managing and distributing Outlook 2002 Visual Basic for Applications (VBA) projects (290779)



The information in this article applies to:

  • Microsoft Outlook 2002

This article was previously published under Q290779
For a Microsoft Outlook 2000 version of this article, see 229911.

SUMMARY

This article provides an overview of how Microsoft Outlook stores Microsoft Visual Basic for Applications code, and how you can manage multiple projects.

MORE INFORMATION

Unlike other Microsoft Office programs, Microsoft Outlook supports only one Visual Basic for Applications project at a time. The project, Project1, is available and associated with the program at all times. It is not possible to add another project in the Visual Basic Editor.

Project1 is stored on your hard disk as VbaProject.OTM in the following folder:

<Drive>:\Windows\Application Data\Microsoft\Outlook

NOTE: The location of the Application Data folder may vary depending on the configuration of user profiles in Windows. To locate the file, use Windows to search your computer for the file VBAProject.otm.

Outlook does not provide a direct means to manage OTM files. Outlook Visual Basic for Applications code was not designed to be deployed or distributed; it was designed solely to be a personal macro development environment.

If you want to begin a new Visual Basic for Applications project, you could theoretically export all of your existing modules and forms, but this is typically not a realistic approach. Instead, follow these steps:
  1. Quit Microsoft Outlook.
  2. Locate your VbaProject.OTM file as described earlier.
  3. Rename the file to something meaningful to you, such as VbaProject-testing.OTM
  4. Restart Microsoft Outlook.
Because Outlook is not able to find an existing project file, Visual Basic Editor starts with a new project. When you save changes to your project, Outlook creates a new VbaProject.OTM in the folder.

If you want to switch between projects, add one additional step to the previous steps:
  1. Quit Microsoft Outlook.
  2. Locate your VbaProject.OTM file.
  3. Rename the file to something meaningful to you, such as VbaProject-testing.OTM
  4. Rename the file you now want to use back to VbaProject.OTM.
  5. Restart Microsoft Outlook.
If you want to move a Visual Basic for Applications project from one computer to another, first determine where Outlook is storing the VbaProject.OTM files on each computer. Then, copy the OTM file from one computer to the other, making sure to place it in the proper folder. When you restart Outlook, it will find the VbaProject.OTM file and use it.

IMPORTANT: Although you can do this, Microsoft Product Support Services cannot support deploying solutions in this way. There are known issues with doing this, and Outlook was not designed to support this functionality. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

290780 OL2002: Code Does Not Work After You Distribute a VBA Project

If you are developing a solution that you intend to distribute to more than a few people, you should convert your Visual Basic for Applications code into an Outlook COM Add-in. However, developing a COM Add-in typically requires considerable more programming knowledge than creating a short macro, so if your Visual Basic for Applications project is relatively simple, and there are not too many people that need to use it, you may want to send them the code with instructions on how to set it up. For additional information about finding resources to learn how to create a COM Add-in, click the article number below to view the article in the Microsoft Knowledge Base:

291163 OL2002: How to Create a COM Add-in for Outlook

REFERENCES

For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:

287530 OL2002: Questions About Custom Forms and Outlook Solutions


Modification Type:MajorLast Reviewed:8/2/2004
Keywords:kbAddIn KbVBA kbhowto KB290779