
To sign a macro using selfcert, you first need to create a certificate. You can also add macros to toolbar or ribbon buttons.


You can also open the Macros dialog using Alt+F8 (all versions). In Outlook 2010, you need to show the Developer ribbon first (File, Options, Customize Ribbon - check Developer ribbon on the right). To run the macro from Outlook 2007 or older, go to Tools, Macro, Macros and select the macro. If you will be using the macro often, you should use selfcert to sign it then set Macro Security to only allow signed macros.ĭon't sign the macro until you are done tweaking it and if you tweak it later, you'll need to re-sign it. (It's highly recommended you make a backup of the folders or message store before running macros.)Ĭtrl+Break will pause the macro, or press the Stop button on the toolbar to end it. Press F5 or the Run button to run the macro from the VBA editor. To add a module to the VBA project, right click on Project1 and choose Insert > Module to insert a new module. If your screen does not resemble the screenshot above, with the white editing pane open, you'll need to click on Microsoft Outlook Objects to expand it then double click on ThisOutlookSession to open it in the editing pane on the right side. In Outlook 2007 and older, the command in on the Tools, Macros menu. Press Alt+F11 on your keyboard, or if you are showing the Developer ribbon, click the Visual Basic Editor command to open it. Now you are ready to open the VBA Editor. You may need to restart Outlook after changing the security setting.

Note that some security software will set it to High and your macros will not run. Do not choose the Low option (run all, never ask), except during testing. It's highly recommended that you set the Macro Security level to only allow digitally signed macros. Outlook 2010 and up: File, Options, Trust Center, Trust Center Settings, Macro Security.

Outlook 2007 and older: Access the dialog to change the security level from Tools, Macros, Security. Check Macro Security Levelīefore you begin, you'll need to check your macro security setting, otherwise, you'll need to use selfcert.exe to sign your macros to test them. If the code runs against a specific folder, copying the folder and contents may be enough "insurance", (You should have routine backups regardless, but I know many users don't bother.) At least very least, make a copy of the items in the folder you are running the code against. If the code will be run against items in your mailbox or personal folders, you should make a backup of the mailbox or data file, just in case something goes wrong with the code. We're going to assume the code is 100% ready-to-use, not a code snippet that is half complete.
