Excel 2013 How to Add Digital Signature to VBA?

btorrean

Board Regular
Joined
Dec 2, 2011
Messages
76
Dear Forum,

I have recently purchased a digital signature certificate to use with my Excel workbooks. My purpose is to digitally sign my VBA code. I am able to digitally sign the workbooks using the signature insert in the workbook ribbon, however, I can't sign the code from the VBA editor. I am using Excel 2013 on a Windows 10 PC.

In the VBA editor, when I go to Tools >> Digtial Signature, I get the following message box:

VBA Code:
The VBA project is currently signed as
Certificate name: [No certificate]
Sign as
Certificate name: [No certificate]

When I click 'Choose', I get the following notification:

Code:
No usable signing certificates are available. Please insert your smart card, or contact your administrator to obtain a signing certificate.

I have also tried, unsuccessfully, adding the certificate in the Trust Center.

Can anyone tell me what I am doing wrong?

Brian
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Add the certificate to the following Current User stores: Trusted Root Certification Authorities, Trusted Publishers and Personal. I don't know if all 3 are required. After that the certificate should be available in VBA Tools -> Digital Signature.
 
Upvote 0
Solution
Dear John_w,

Thanks for your reply. I have done as you suggested, following the instructions here. When done, I closed the mmc, re-started Excel and attempted to select a signature. I got the same message. I also tried running Excel as an administrator (which I am on my computer), with the same result.

excel-no-digital-signatures.jpg


Do you have any other ideas?

Brian
 
Upvote 0
Have you rebooted?

From that link, try also "Import the Certification Authority's certificate into the Trusted Root Certification Authorities folder in the Certificates (Local Computer) node."
 
Upvote 0
Have you rebooted?

From that link, try also "Import the Certification Authority's certificate into the Trusted Root Certification Authorities folder in the Certificates (Local Computer) node."
John,

I rebooted and also imported the certificates to the Trusted Root Certification Authorities folder in the Certificates (Local Computer) node. Please see image below.
mmc_2021-02-08_11-54-36-w-arrows.jpg

I still get the same message as before in Excel, not showing any certificates as available, and not allowing me to choose any.

Initially, I installed the certificates using Firefox, as that is the web browser I use. On a whim, I decided to check certificates in Microsoft Edge, to see if that made any difference. Even after importing my certificates to the Trusted Root Certificates folder using Edge, my certificates still don't show up in the list. Please see image below.
msedge_2021-02-08_12-08-26.jpg

Should appear as "Brian J. Torreano" in the list, but as you can see, the certificates aren't there.

Do you have any other ideas? I'm about to throw my computer out the window! ?

Brian
 
Upvote 0
I think Intended Purposes must include Code Signing for the certificate to be available to the VBA project.

You could try adding Code Signing to the certificate. To do this, right-click the certificate in MMC -> click Properties -> Extended Validation tab -> enter 1.3.6.1.5.5.7.3.3 in the input box -> click Add OID -> click OK.

The certificate I use for signing VBA projects was self-certified using solution version 1 at:

 
Upvote 0
John_w, I attempted that to no avail. I am going to mark your first solution as an answer, because that will probably work for most people. At this point, I'm giving up. F-ing Microsoft.

Brian
 
Upvote 0
I was able to fix this by importing the certificate via the Internet Options / Content / Certificates interface, into the following three stores: Personal, Trusted Publishers, Trusted Root Certification Authorities.

Previously, I'd imported the certificate into all three locations via "Manage computer certificates", for machine-level, and "Manage user certificates", for user-level, but although the certificate showed up in all six locations (three locations machine, three locations user), Excel didn't recognize it.

However, going through the Internet Options UI did the trick.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top