Microsoft KB Archive/229911

From BetaArchive Wiki
Knowledge Base


OL2000: Managing and Distributing Outlook VBA Projects

Article ID: 229911

Article Last Modified on 11/5/2003



APPLIES TO

  • Microsoft Outlook 2000 Standard Edition



This article was previously published under Q229911

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, follow these steps:

  1. Click Start, point to Find, and then click Files or Folders.
  2. In the Named box, type *.OTM
  3. Select the appropriate drive or drives and then click Find Now.

Outlook does not provide a direct means to manage OTM files. 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 answers to commonly asked questions about Microsoft Outlook 2000 solutions, please see the following article in the Microsoft Knowledge Base:

146636 OL2000: Questions About Custom Forms and Outlook Solutions



Additional query words: OutSol OutSol2000 vbscript

Keywords: kbhowto kbprogramming KB229911