When you create a macro and are running Outlook with the default security settings, you are not able to run the macro at all or you’ll always get prompted first, unless you either tamper with the default security settings or sign your own code with a digital certificate.
Since it is not very common to have your own digital certificate, you probably set your macro security to a lower level to be able to run your macro.
There is no need for that; You can sign your own macros with SelfCert.exe so macros can run without lowering your Outlook security settings.
The steps to achieve this are as follows:
SelfCert.exe is the application called “Digital Certificate for VBA Projects”. For Office 2007 and Office 2010, it is directly exposed in the Start Menu under:
Start-> All Programs-> Microsoft Office-> Microsoft Office <version> Tools-> Digital Certificate for VBA Projects
Opening the Start menu and typing “VBA” should bring it up as well.
Alternative method of locating SelfCert.exe
Can’t find it in the Start Menu? By default you can find SelfCert.exe in the following location;
- Windows 32-bit
C:\Program Files\Microsoft Office 15\root\office15
SelfCert.exe is not installed
If it is not there, run Office setup and choose “Add or Remove Features”. With older versions of Office you’ll need to choose “Custom installation” and then “Advanced customization”.
Expand the “Office Shared Features” section and select “Digital Certificate for VBA Projects” to be ran from your computer. For Office 2000 you can find this under the Office Tools section.
Simply run SelfCert.exe after locating it by one of the methods listed above. It will prompt you to name the certificate. Personally, I use my username because that is the most convenient to me but you can also give it the name of
your company or whatever you want.
After pressing OK, you’ll get a “SelfCert Success” message.
Signing your code
Certificate selection dialog in Windows 7.
Certificate selection dialog in Windows XP.
Checking your macro security level
First, let’s check if your macro security level is still set correctly. You’ll need to do this in the main Outlook window and not from the VBA Editor window.
- Outlook 2003 and previous
File-> Options-> Trust Center-> Trust Center Settings…-> Macro Settings-> option: Notifications for digitally signed macros, all other macros disabled
Now that we’ve signed the code and verified that the security settings are set correctly you must close Outlook. You’ll get prompted if you want save changes to your VBA project. Choose “Yes”. Once Outlook is fully closed start it again.
Running your signed macro for the first time
All preparations are now done and you can run the macro in one of the following ways;
- Run it directly from the Visual Basic Editor (keyboard shortcut ALT+F11).
- Run it from the Macros dialog (keyboard shortcut (ALT+F8).
- Run it via a button that you created for the macro .
Since it is the first time that you are using the certificate, you’ll be prompted what to do. Select that you’ll always trust the macros or documents from this publisher and you’re done! Now your own macros will run without any nasty security prompts and you can still enjoy Outlook with your security settings on high.
In Outlook 2007 and later, press the “Show Signature Details” link to see
that you are indeed the one who signed the macro.
If you can’t trust yourself… (Macro Security dialog in Outlook 2003 and previous)