Signing your own macros with SelfCert.exe

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:


Locating SelfCert.exe

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

Open SelfCert.exe or the "Digital Certificate for VBA Projects" application by typing "VBA" in the Start Menu.
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\Office <version number>
  • Windows 64-bit with Office 32-bit
    C:\Program Files (x86)\Microsoft Office\Office <version number>
  • Windows 64-bit with Office 64-bit
    C:\Program Files\Microsoft Office\Office <version number>
  • Office 365 (Subscription based or Click-to-Run version of Office 2013)
    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.

Using SelfCert.exe

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.

Create Digital Certificate with SelfCert.exe
As explained in the dialog, a self signed certificate is for personal use only.

Signing your code

Back in the VBA Editor (ALT+F11) where you created the macro choose;
Tools-> Digital Signature…

You’ll see that the current VBA project isn’t signed yet. Press the Choose… button and you’ll get a screen to select a certificate. Now you can choose the certificate you just created.

Choose the Digital Signature for your VBA project
Currently the project is unsigned.

Certificate selection dialog in Windows 7.
Certificate selection dialog in Windows 7.

Certificate selection dialog in Windows XP.
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
    Tools-> Macro-> Security…-> option: High. Only signed macros from trusted sources will be allowed to run. Unsigned macros are automatically disabled.
  • Outlook 2007
    Tools-> Macro-> Security…-> option: Warnings for signed macros, all unsigned macros are disabled
  • Outlook 2010 and Outlook 2013
    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;

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.

Microsoft Office Outlook Security Notice - In Outlook 2007 and later, press the "Show Signature Details" link to see that you are indeed the one who signed the macro.
In Outlook 2007 and later, press the “Show Signature Details” link to see
that you are indeed the one who signed the macro.

Macro Security Warning - Trust Publisher - Outlook 2003
If you can’t trust yourself… (Macro Security dialog in Outlook 2003 and previous)