Outlook Developer Home
Outlook Programmer's Library
 
Outlook Technologies
Outlook Forms
Languages
Samples
Other Technologies

 

 

TIP: To prevent Outlook from running VBA macros at startup

Let's say you add code to the Application_Start event handler in the ThisOutlookSession module, but there's a problem with the code that causes an access violation or some other error that prevents Outlook from starting. How can you get Outlook start without running your code, so you can get back into VBA and correct the problem? 

Thanks to Outlook MVP Ken Slovak for this tip from the Outlook programming newsgroups.

Method #1 | Method #2 | Avoiding the problem | Notes | More Information

Method #1: Change the security settings

Try changing the security settings in Tools | Macro | Security. If you have not signed the VBA code project, set security to Medium, start Outlook and, when prompted, choose Disable Macros. 

If you have signed the project, try removing your self-signed certificate from Trusted Sources, then set security to High and restart Outlook.

Back to Top

Method #2: Rename the VBAProject.OTM file

Use Start | Find to locate the VBAProject.OTM file. This file contains all your Outlook 2000 VBA macros. If you rename it, then restart Outlook, Outlook will create a new, empty VBAProject.OTM. Unfortunately, there doesn't seem to be any way to import your projects from the original .OTM file. 
Back to Top

Avoiding the problem

The best thing to do when developing macros that will be running in Application_Startup is to place them in a class module and test them from there. Then, only when they are running properly, put them in Application_Startup.
Back to Top

Notes

If you have had macros in VBAProject.OTM, have signed the project or set macro security to Low and remove all the code, you will still get the VBA macro warning message -- even with all the macros removed. The fix for that is to delete or rename VBAProject.OTM. Outlook will create a new, empty VBAProject.OTM file next time it starts, and the macro warning message will stop.
Back to Top

More Information

   
2002-7 TurtleFlock, LLC
All right reserved.
About OutlookCode.com

Send comments to webmaster@outlookcode.com

Designed and Implemented by TerraLink USA 

FrontPage Integration
by RobsonDesignWorks

 
 
get Sue's code | forums | share your own code | registration