none
Unable to sign Outlook 2010 VBAProject RRS feed

  • Question

  • Is anyone else having problems digitally signing VBA projects with current Outlook 2010?

    I'm using Outlook 14.0.7106.5003, with all updates. I originally ran into this problem with a new cert from an enterprise CA, but I get the same problem with a newly created self-signed cert. It happens on multiple PCs at multiple sites (in different domains). It's easy (for me) to reproduce:

      • Create a new self-signed cert via Office 2010 Tools > Digital Certificate for VBA Projects
      
    • Starting with no existing VBAProject.OTM, open Outlook > Developer > Visual Basic and paste any Outlook VBA into ThisOutlookSession. I've had the same problem with my original code, as well as trivial code like:
    Sub HelloWorldMessage()
        Dim msg As Outlook.MailItem
        Set msg = Application.CreateItem(olMailItem)
        msg.Subject = "Hello World!"
        msg.Display
        Set msg = Nothing
    End Sub
    • Save it and digitally sign it with the new self-signed cert
    • Close Outlook and save VBAProject.OTM when prompted
    • Re-open Outlook.

    I always get an error:
      An error occurred while attempting to verify the VBA project's signature.  Macros will be disabled.
    and when I open the project in Outlook, it shows as not signed. If I re-sign it, with either the self-signed cert or my CA cert, I get the same results.

    FWIW, I don't have the problem on one Outlook 2007 (non-domain) install I have access to, also using a new self-signed cert.

    This much should be simple. Why won't it work? Is this a problem introduced in a recent Outlook 2010 update?

    Thanks, in advance.

    John

    Friday, January 31, 2014 7:35 AM

Answers

  • I have no idea if you are doing anything wrong. Those are basically the same steps I used.  I changed the save order - and I only used run as admin once, after signing the macro, not to sign the macro.

    • selected Tools -> Digital Signature -> Choose...
    • selected My Test Certificate (Outlook then showed the project signed with this certificate)
    • Save it.
    • closed VBA
    • closed Outlook, and chose Yes to save the VBA project <== i think this is a clue because i get this even though I saved the VBA before closing the editor.

    I reopen outlook using run as admin and get the allow certificates dialogs, at which point i always trust each one.

    1. Open Outlook normally.
    2. Macro security is set to none.
    3. Create cert and sign macro.
    4. Click Save then close Editor.
    5. Set security to ask about signed macros.
    6. Close Outlook. If asked to save vba, click Yes.
    7. Restart outlook using run as administrator. Dialog comes up for each addin, asking me to trust certificates. I choose 'trust all from publisher'. Macro works.
    8. Restart Outlook normally. Because i choose to always trust the macro, the dialog doesn't come up. macro works.  

    Instead of Step 7's run as admin, if I copied the cert to trusted authorities - then the 'trust macros' dialog should come up running outlook as a normal user. Doing both would have no adverse affect.



    Diane Poremsky [MVP - Outlook]
    Outlook & Exchange Solutions Center
    Outlook Tips
    Subscribe to Exchange Messaging Outlook weekly newsletter

    • Marked as answer by JWit Tuesday, February 18, 2014 6:01 AM
    Monday, February 17, 2014 5:52 PM

All replies

  • Thursday, February 6, 2014 3:13 AM
  • Hi John

    Did anyone shed any light on this please? I'm having the very same problem.

    Thanks

    Gwen

    Thursday, February 6, 2014 5:18 PM
  • Please refer to this and find if any help:http://caddtechconsulting.blogspot.in/2010/04/vba-problems-in-outlook-2010.html

    Thanks for the link. However, I'd found this before posting here, and tried password protecting my project, but this didn't solve the problem for me.

    (While at this point I'd be happy for a workaround that worked reliably, signing with a self-signed cert should simply work -- with no need for workarounds...)

    Friday, February 7, 2014 8:43 AM
  • Unfortunately not yet...
    Friday, February 7, 2014 8:52 AM
  • I found a related post about this same issue at
        answers.microsoft.com
    but after trying all the suggestions there I'm still getting the same error
        An error occurred while attempting to verify the VBA project's signature.  Macros will be disabled.

    I think there must be some root cause for this flakey signing behavior, but I don't know what it is...

    Monday, February 10, 2014 1:14 AM
  • Start Outlook using Run as administrator once and choose the option to trust the certificate. The other option is to copy the certificate to the trusted root store. (Both methods worked here.)



    Diane Poremsky [MVP - Outlook]
    Outlook & Exchange Solutions Center
    Outlook Tips
    Subscribe to Exchange Messaging Outlook weekly newsletter

    Sunday, February 16, 2014 3:37 AM
  • Thanks for the suggestions, but I must be missing something, as I've tried these and I still get the error.

    Thinking this problem might be caused by a recent update, I created a new Win 7 Pro SP1 VM and installed Office 2010 Pro Plus SP1, but didn't install any Windows Updates. Leaving Win7 as a workgroup member, and using the initial user account, I went through the following (including your suggestions):

    • created a basic Outlook 2010 profile (no email support)
    • ran Microsoft Office 2010 Tools > Digital Certificate for VBA Projects
    • created My Test Certificate
    • ran certmgr.msc
    • copied My Test Certificate from Personal\Certificates to Trusted Root Certification Authorities\Certificates
    • ran Outlook.exe as Administrator
    • selected Developer -> Visual Basic
    • pasted into Project1 -> Microsoft Outlook Objects -> ThisOutlookSession this simple code:
      Sub HelloWorldMessage()
        MsgBox "Hello world!"
      End Sub
    • ran it, and got the expected pop-up message
    • saved it
    • selected Tools -> Digital Signature -> Choose...
    • selected My Test Certificate (Outlook then showed the project signed with this certificate)
    • closed VBA
    • closed Outlook, and chose Yes to save the VBA project
    • ran Outlook.exe again as Administrator
    • selected Developer -> Visual Basic
    • at which point I got the same error: An error occurred while attempting to verify the VBA project's signature.  Macros will be disabled.

    What am I doing wrong here?

    Thanks,
    John

    Monday, February 17, 2014 5:07 AM
  • I have no idea if you are doing anything wrong. Those are basically the same steps I used.  I changed the save order - and I only used run as admin once, after signing the macro, not to sign the macro.

    • selected Tools -> Digital Signature -> Choose...
    • selected My Test Certificate (Outlook then showed the project signed with this certificate)
    • Save it.
    • closed VBA
    • closed Outlook, and chose Yes to save the VBA project <== i think this is a clue because i get this even though I saved the VBA before closing the editor.

    I reopen outlook using run as admin and get the allow certificates dialogs, at which point i always trust each one.

    1. Open Outlook normally.
    2. Macro security is set to none.
    3. Create cert and sign macro.
    4. Click Save then close Editor.
    5. Set security to ask about signed macros.
    6. Close Outlook. If asked to save vba, click Yes.
    7. Restart outlook using run as administrator. Dialog comes up for each addin, asking me to trust certificates. I choose 'trust all from publisher'. Macro works.
    8. Restart Outlook normally. Because i choose to always trust the macro, the dialog doesn't come up. macro works.  

    Instead of Step 7's run as admin, if I copied the cert to trusted authorities - then the 'trust macros' dialog should come up running outlook as a normal user. Doing both would have no adverse affect.



    Diane Poremsky [MVP - Outlook]
    Outlook & Exchange Solutions Center
    Outlook Tips
    Subscribe to Exchange Messaging Outlook weekly newsletter

    • Marked as answer by JWit Tuesday, February 18, 2014 6:01 AM
    Monday, February 17, 2014 5:52 PM
  • [...]
    • Save it.
    • closed VBA
    • closed Outlook, and chose Yes to save the VBA project <== i think this is a clue because i get this even though I saved the VBA before closing the editor.

    [...]

    Thanks VERY much for pointing to the issue here. I can follow all my original steps, and

    • if I don't save after signing, and only save when Outlook exits, I get the error when I later open the macro;
    • if I save after signing, before closing the VBA editor, and again when Outlook exits, the signing works as it should.

    I'll test this further later, but I've already repeated this a few times, with the same results. It seems clear that the project must be saved after signing, even though

    • Outlook doesn't prompt to save when you close the VBA editor
    • Outlook does prompt to save when you exit Outlook, and the project is saved then.

    John

    • Proposed as answer by bezanson Friday, April 25, 2014 5:45 PM
    Tuesday, February 18, 2014 6:11 AM
  • Interesting. Thanks for testing it. :) I always hit save in the VBE before closing it, just in case outlook crashes before I exit, so it was second nature to work like that. The second save prompt only comes up when i use signed macros.


    Diane Poremsky [MVP - Outlook]
    Outlook & Exchange Solutions Center
    Outlook Tips
    Subscribe to Exchange Messaging Outlook weekly newsletter

    Tuesday, February 18, 2014 6:21 AM
  • Thanks John. It wasn't until I tried the "double-save" that things worked for me. Finally a solution it seems :-).
    Friday, April 25, 2014 5:45 PM
  • Thanks. This reminds me to add an update on this issue, to help anyone still struggling with this.

    The "double-save" procedure works for Outlook 2010 projects signed with a self-signed cert, but I could not get it to work when signing with an enterprise CA cert. After signing with the CA cert, launching Outlook opens the "Microsoft Outlook Security Notice" dialog with an alert "Warning: An error occurred while verifying signature. Do not trust these credentials." and the "Trust all documents from this publisher" button greyed out.

    A colleague found the additional steps to fix this:

    • ignore the warning and Enable Macros
    • open the macro in the VB editor
    • open the signing dialog but make no change, and click OK to exit
    • close the VB editor without saving (this is the opposite of what's required during the initial signing, but if you save at this step the problem is not resolved)
    • exit Outlook, and do save the VBA project when prompted

    This process has worked repeatedly at a number of sites. But I wish I new why is such a convoluted and undocumented process is required...

    John

    Saturday, April 26, 2014 9:26 PM
  • That extra save was the "gotcha" that solved the issue for me too.  My normal procedure had been to

    1. Sign the project (Tools / Digital Signature / pick a certificate)
    2. Alt-F4 to close the VBA window.
    3. Alt-F-X to close Outlook.
    4. "yes" at the prompt for "Do you want to save the VBA project 'VbaProject.OTM'?"
    5. Restart Outlook.
    6. ...

    What Diane Poremsky has been doing out of habit, and which also solves the issue, was:

    1. Sign the project (Tools / Digital Signature / pick a certificate)
    2. Ctrl-S to save the VBA project.
    3. Alt-F4 to close the VBA window.
    4. Alt-F-X to close Outlook.
    5. "yes" at the prompt for "Do you want to save the VBA project 'VbaProject.OTM'?"
    6. Restart Outlook.
    7. ...

    Apparently with Outlook 2010 the digital signature selection is getting saved when you do the Ctrl-S and is not saved if you answer "yes" to the "Do you want to save the VBA project 'VbaProject.OTM'" prompt.

    You should also do the Ctrl-S step if you you remove the digital signature. I discovered if I remove the signature, exit, restart that the project still shows as signed and I can run macros meaning the removal was not saved.

    Wednesday, June 18, 2014 4:23 AM
  • Wow, yes this small difference in process made it work for me.
    Friday, November 3, 2017 7:27 PM