none
How to install a code signing certificate for Excel VBA / Macros RRS feed

  • Question

  • Hello,

    I have been tasked with obtaining and installing a code signing certificate to sign VBA code in Excel 2016.

    I have created a certificate request and purchased a Code Signing Certificate from GoDaddy (https://www.godaddy.com/web-security/code-signing-certificate).

    I have obtained the certificate (SHA2 with a .spc extension) and installed the certificate in the personal certificate store on the same computer (running Windows Server 2012 R2) as the request was made.

    When attempting to sign using the certificate in Excel 2016 (while in the VBA code using Tools -> Digital Certificate) , I receive the message ‘No usable signing certificates are available. Please insert your smart card, or contact your administrator to obtain a signing certificate.’

    How do I install the certificate so that Excel will recognize it?

    Thank you.

    Wednesday, February 7, 2018 5:17 PM

Answers

  • I was able to get this to work, by re-keying the certificate with a new CSR. These are the steps I used to generate the CSR for a GoDaddy Code Signing Certificate for use with Microsoft Excel:

    1. Certificates – Current User – Personal
      1. Right click -> All tasks -> Advanced Operations -> Create custom request
    2. Before you Begin screen
      1. Click Next
    3. Select Certificate Enrollment Policy screen
      1. ‘Active Directory Enrollment Policy’ should be showing
      2. Click Next
    4. Custom request screen
      1. Template: Code Signing
      2. Request Format: PKCS #10
      3. Click Next
    5. Certificate Information screen
      1. Choose Details
      2. Click Properties button
      3. General Tab
        1. Type any Friendly name for the cert
      4. Subject Tab
        1. Add the following under Subject name / Type:
          1. Organization
          2. Common name
          3. Locality (city name)
          4. State (full name)
          5. Country (US)
        2. Private Key Tab
          1. Under Key options
            1. Check Make private key exportable
          2. Click Ok to close dialog
          3. From Certificate Information screen, click Next, choose a file location for your CSR, and click Finish

     

    Once you get the certificate back from GoDaddy, install under Certificates – Current User – Personal to have access to the certificate for the user logged in when installed.

    Tested with Windows 10 / Excel 2013 and Windows Server 2012 R2 / Excel 2016.


    Monday, February 12, 2018 2:51 PM

All replies

  • Hi,

    Did you make contact GoDaddy and ask your question?
    I suppose GoDaddy have an answer.

    Regards,

    Ashidacchi

    Thursday, February 8, 2018 1:19 AM
  • Hi bwalls,

    As per the GoDaddy. Below are the steps to sign documents.

    Code Signing Microsoft Office Macros and Visual Basic for Applications

    As per the Microsoft, Below are the steps to sign documents.

    Digitally sign your macro project

    You can see that steps are same in both links.

    Further, I find that in some old version of Office and some old updates had this issue.

    For old versions like Excel 2010, There are some hotfix are available.

    Then I find that, Some users of Office 2016 also has this issue.

    Which was solved in update Version: 1708 (Build: 8431.2107).

    So I suggest you to try to update your Excel with latest updates and check whether issue is persist or not.

    Let us know about your testing result.

    We will try to provide you further suggestions, If needed.

    Disclaimer: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, February 8, 2018 8:59 AM
    Moderator
  • Thank you for the suggestion. I did contact GoDaddy, but they would not provide support for Excel (wouldn't even confirm if their code signing certificates would work with Excel) and stated I need to contact Microsoft.
    Thursday, February 8, 2018 1:33 PM
  • I have seen those articles and they did not resolve the issue. Excel seems to be unaware my certificate exists giving me the message 'No usable signing certificates are available'. 

    On the Excel version, I am not using Office 365, which I believe the build you referenced above is only applicable for Office 365. The version of Excel I am using is listed as:

    Microsoft Excel 2016 MSO 16.0.4639.1000 64-bit

    thank you.

    Thursday, February 8, 2018 1:52 PM
  • Hi bwalls,

    This issue is in Excel application. We cannot correct it by any setting or by code.

    For testing purpose you may try to uninstall the current update and try to move to last update and check whether on that update you can able to sign the document or not.

    Further, You can try to provide your feedback to Excel User Voice regarding this issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 9, 2018 6:39 AM
    Moderator
  • Hi bwalls,

    This issue is in Excel application. We cannot correct it by any setting or by code.

    For testing purpose you may try to uninstall the current update and try to move to last update and check whether on that update you can able to sign the document or not.

    Further, You can try to provide your feedback to Excel User Voice regarding this issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Hi Deepak,

    Are you stating that it is no longer possible to sign VBA code / Marcos in Excel?

    Is there a KB article associated to this that points to a specific update? I do not understand what I would need to uninstall to make this work. Also, is this specific with Excel 2016? Would Excel 2013 still possibly work?

    Friday, February 9, 2018 10:45 AM
  • Hi bwalls,

    You had asked,"Are you stating that it is no longer possible to sign VBA code / Marcos in Excel?"

    The feature is still there and it is possible to sign a VBA code, But some updates have some issue with this feature.

    This is the reason that this feature is not working currently.

    It is possible that when new update get launched and this feature again start working normally.

    Based on my search, I find that this issue can occur with any version of Excel. Whether it is Excel 2016 , 2013 or  2010.

    There is no KB article available that describes the exact updates having this issue.

    The information I provide you is based on my search.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 12, 2018 8:45 AM
    Moderator
  • I was able to get this to work, by re-keying the certificate with a new CSR. These are the steps I used to generate the CSR for a GoDaddy Code Signing Certificate for use with Microsoft Excel:

    1. Certificates – Current User – Personal
      1. Right click -> All tasks -> Advanced Operations -> Create custom request
    2. Before you Begin screen
      1. Click Next
    3. Select Certificate Enrollment Policy screen
      1. ‘Active Directory Enrollment Policy’ should be showing
      2. Click Next
    4. Custom request screen
      1. Template: Code Signing
      2. Request Format: PKCS #10
      3. Click Next
    5. Certificate Information screen
      1. Choose Details
      2. Click Properties button
      3. General Tab
        1. Type any Friendly name for the cert
      4. Subject Tab
        1. Add the following under Subject name / Type:
          1. Organization
          2. Common name
          3. Locality (city name)
          4. State (full name)
          5. Country (US)
        2. Private Key Tab
          1. Under Key options
            1. Check Make private key exportable
          2. Click Ok to close dialog
          3. From Certificate Information screen, click Next, choose a file location for your CSR, and click Finish

     

    Once you get the certificate back from GoDaddy, install under Certificates – Current User – Personal to have access to the certificate for the user logged in when installed.

    Tested with Windows 10 / Excel 2013 and Windows Server 2012 R2 / Excel 2016.


    Monday, February 12, 2018 2:51 PM
  • Hi bwalls,

    From your last post, It looks like your issue is solved now.

    This thread is still open.

    I suggest you to mark your own last post as an answer.

    It will help us to close this thread and It will help other community members in future who will meet with same kind of issue.

    Thanks for your understanding.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 13, 2018 12:50 AM
    Moderator
  • The issue is resolved and I marked as answer.

    Thank you

    Tuesday, February 13, 2018 6:42 AM
  • We had that same error message, using Office 365 on Win10.

    We already had code signing certificates in the Trusted Publisher folder in the certificate repository. 

    We got VBA signing to work as follows:

    1. Run mmc and add the Certificate snap in for My User Account
    2. Import the existing code signing certificate pfx file into the Personal folder in the certificate repository (r-click Personal and then select Import on the context menu)

    That's it. After import we were able to sign our VBA files.



    Thursday, June 6, 2019 11:05 AM
  • For anyone struggling with this issue, because there are no good answers available.

    Rekeying the certificate works because (potentially) you have imported into your certificate store your plain cert (pubkey only) and your cert bundle (pubkey+prikey).

    Using a internal PKI infrastructure i was unable to sign Excel VBA because excel would enumerate the pubkey certificate. then skip the second entry for pubkey+prikey, because im assuming the public portion was identical. hence no valid certificates were found due to no private keys were available at execution time.

    the fix is to delete the pubkey only certificate if you do in fact have two there. how this happens with GoDaddy and others would be the user incorrectly imports the public and private certificates into the personal store, instead of only the private + public key bundle.

    Would be a easy mistake to make

    Wednesday, August 12, 2020 9:58 PM