9

After a computer reset I wanted to use my VBA Macros for Outlook 2013.

In Outlook I get the error message:

"An errror occured while attempting to verify the VBA project's signature. Macros will be disabled."

Consequently the VBA editor states:

"The macros in this project are disabled. [..]"

I have tried:

  1. Developer -> Macro Security -> (*) Enable all Macros (not only digitally signed)

  2. Define a certificate using

    C:\Program Files (x86)\Microsoft Office\Office15\selfcert.exe
    

Nothing worked. Any idea?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
BerndGit
  • 1,530
  • 3
  • 18
  • 47

4 Answers4

11

Having come across this just now, this is how I ultimately solved it (none of the other suggestions worked for me):

  1. Create a self cert – I called mine “Self Cert” (generated from here in Office 2013 - C:\Program Files (x86)\Microsoft Office\Office15\SELFCERT.EXE)
  2. Run certmgr.crt from the start menu and copy “Self Cert” from “Personal\Certificates” to the “Trusted Root Certification Authorities\Certificates” folder
  3. Open Outlook.exe as Administrator
  4. Open VBA (i.e. Developer -> Visual Basic)
  5. Open your module containing the VBA code
  6. Select Tools -> Digital Signature -> Choose...
  7. Select OK to select “Self Cert” (VB then shows the project as being signed with this certificate) then click OK again accept and close the window
  8. Click to save the macro in VBA – actually click the save button in VB (bizarrely it breaks if you don’t expressly save here)
  9. Close VBA
  10. Close Outlook, and choose Yes to save the VBA project
  11. Restart Outlook.exe again as Administrator
  12. Either now, or after you go “Developer -> Visual Basic” again, a window should pop-up prompting you about the newly signed macro – I clicked remember and don’t prompt again
  13. Macros should now work! I'm using them as part of an email rule and this now processes perfectly.

I’m not strictly sure you need to run Outlook as an administrator in the above, but it now works without being run as an administrator so I’m happy.

Thanks to this resource for getting this working for me! I've basically just updated, consolidated and expanded on answers given. https://social.technet.microsoft.com/Forums/en-US/07f0158c-085b-4031-93a1-c9d047cf855c/unable-to-sign-outlook-2010-vbaproject?forum=outlook

adam
  • 481
  • 5
  • 7
  • Additionally, I had to copy my macro code, delete the VBA project, close Outlook, delete the OTM file in the %AppData%\Microsoft\Outlook folder, reopen Outlook, create a new macro project, paste in the copied code, add the certificate, and voila! – Darren Griffith Jul 17 '18 at 18:05
  • works perfeclty, now you can change option in Outlook Trust Center to Notifications for digitally signed macros, all other macros disabled. – Novice Apr 23 '19 at 15:03
  • For Office 365 `selfcert.exe` is not creating certificates under `\Personal\Certificates`. Searching in certificate manager returns no results. Any thoughts on where I should look? – virtualxtc May 13 '21 at 13:43
  • Working now: no need to use certificate manager if you remember to do the double save (steps 8 and 10) – virtualxtc May 14 '21 at 19:49
  • For me it worked after executing step 8) to explicitly click Save in the VBA editor. No need for admin mode, just that explicit Save click. Saying "Yes" to the save the VBA code question when closing Outlook was not enough in my case – SvenC Oct 27 '22 at 09:36
2

Ok, I found the reason for my problem:

(1) The Certificate nameofmycert by selfcert.exe was assigned to my VBA project.

(2) However I didn't assign it to a trusted authority, like seen in: https://technet.microsoft.com/en-us/library/cc754841.aspx#BKMK_addlocal

(3) Outlook was set to allow all macros (not only digitally signed). Anyhow it found that my VBA project was certified, but was not sure if the cerification is correct, because of (2). Therefore it deactivated all macros.

(4) In VBA/Tools / Dignital Signature it appeared:

Certificate name: [no certificate]
Sign as: nameofmycert

The remove-botton was deactivated.

Solution:

(1) VBA/Tools / Digital Signature

(2) Click on Choose .. and select a cerificate. Then the remove-botton is activated.

(3) Click on Remove Certificate

(4) Save VBA project

(5) Restart Outlook

BerndGit
  • 1,530
  • 3
  • 18
  • 47
  • That's because your project/code used a self-signed certificate. When you move the code on another machine you need to use a certificate from a trusted vendor which can confirm that. Self-signed certificates are used for testing mainly. – Eugene Astafiev Nov 27 '17 at 11:25
  • Worth noting that the reason I got into self-signing macros was so I could run with higher security, disabling unsigned macros. After setting macro security thus and starting Outlook as non-admin, I was prompted to trust M$ cert for VBA and to trust my self-signed cert. I did so, and _then_ all was well. – tbc0 Jul 20 '18 at 15:09
2

I had this same problem and the solution here fixed it: https://social.technet.microsoft.com/Forums/en-US/07f0158c-085b-4031-93a1-c9d047cf855c/unable-to-sign-outlook-2010-vbaproject?forum=outlook. The thread is long, but the gist of it is you need to manually save your VBA project after signing, and before exiting the VBA editor. Scroll down about 2/3rds of the way to the post by "Diane Poremsky [MVP]".

ChaosFreak
  • 574
  • 1
  • 6
  • 18
  • This resolve it for me, I had done everything correctly, but I basically had to go "File, Save" from VB Editor. I have a feeling this is related to me already having Macros existing before I started messing with certs, but I'm not sure. – FreeSoftwareServers Nov 08 '19 at 02:30
-2

You need to change the Trust Center settings (run all macros, not only digitally signed) or purchase a valid certificate from a trusted authority.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • This is equivalent the option (1), which i have tried. Unfortunatly this solution which seemed to be obvious was not working. Outlook deactivated the macros regardless of this option. – BerndGit Jun 03 '15 at 14:37
  • Did you try to restart Outlook after changing the Trust Center settings? – Eugene Astafiev Jun 03 '15 at 15:54
  • Yes. I did even try a windows restart. I'm currently suspecting a bug in Outlook and was hoping that there is a known workaround. – BerndGit Jun 08 '15 at 06:40
  • This is not true. You don't need to purchase a certificate. Self-signed certificates should work fine. I had this same problem and the solution here fixed it: https://social.technet.microsoft.com/Forums/en-US/07f0158c-085b-4031-93a1-c9d047cf855c/unable-to-sign-outlook-2010-vbaproject?forum=outlook. The thread is long, but the gist of it is you need to manually save your VBA project after signing, and before exiting the VBA editor. Scroll down about 2/3rds of the way to the post by "Diane Poremsky [MVP]". – ChaosFreak Nov 19 '17 at 17:43
  • Self-signed certificate is designed to work only on your machines. That's made for testing purposes mainly. There should be a third part which can confirm the code comes from a trusted vendor. See [Digital signature](https://en.wikipedia.org/wiki/Digital_signature) for more information. – Eugene Astafiev Nov 27 '17 at 11:23
  • It also seems to be different for different versions of outlook. I have never had any problems with certificates until office 2016. The work around at the top of the thread worked for me. – perfo Apr 08 '18 at 22:57