DelphiFAQ Home Search:

How to digitally sign Excel macros


comments20 comments. Current rating: 5 stars (8 votes). Leave comments and/ or rate it.


I wrote 2 Visual Basic macros for my Excel workbook and now, every time I open this workbook, Excel warns me about my own macro and offers to Enable/ Disable macro execution. How can I get around this nuisance?


You could select a low security setting (Excel: menu Tools -> Macros -> Security) and trust in general all macros and add-ins. This is a quick fix if you just want to try out something and you should immediately restore the setting to 'High' or 'Medium' (where you will be prompted again).

The real solution is to digitally sign your new Excel code. It is actually easier than you think. It will take about 5-10 minutes.

1) First you need to create your own digital certificate. I recommend downloading makecert here:
Direct link:

2) Then go to Windows command line prompt and issue this command (as described on that page)

makecert -r -pe -n "CN=Your Name" -b 01/01/2000 -e 01/01/2099 -eku -ss My

3) (OPTIONAL) If you want to, you can look at your new certificate:
In the "Control Panel", open "Internet Options", then in the middle click on "Certificates".
Your new, self-signed certificate will show up there, along with the expiration date of 2099
This is the place to EXPORT the certificate so that you can import it onto your other computers.

4) start Excel and open the Excel workbook that contains your VBA macro. Open menu item "Tools" --> "Macro" --> "Visual Basic Editor".

5) In the Project Explorer window, select the VBA macro project that you want to digitally sign.

6) In the VBA menu bar, open menu item "Tools" --> "Digital Signature"

7) the Digital Signature dialog will show. Simply select your own certificate and sign your macro.

8) Next time you open Excel, you can chose "Always trust this publisher"

If you use this workbook on more than one computer, you should export your certificate from your first computer and import it onto each of the other computers. See step 3 where you can export. Save the file to your other computers (email it maybe).
Then on the other computers, go to the control panel, same location, and select "Import certificate".

Content-type: text/html


You are on page 1 of 2, other pages: [1] 2
2008-11-08, 12:51:22
anonymous from New Zealand  
Did what you advised to create the certificate - then tried to assign the one I created - but it doesn't appear in the VBA choice box. Also, when I check the credentials of this certificate - it says it's not trusted...what do i do??
2008-11-23, 12:32:52
anonymous from Saudi Arabia  
2009-03-12, 04:11:20
anonymous from United States  
How about if I want to distrubute my program commercially? It would be unacceptable to send out certificates separately. Is there any way that I can make the Excel component of my app trusted within the context of the VB.NET containing app so that my users can just install the application like any client without special efforts to import a separate certificate?
2009-03-15, 09:15:09
anonymous from Canada  
Wow, worked like a charm... Keep up the good work.
2009-04-29, 00:12:40
anonymous from Australia  
Nice! Worked first go. Thanks for clear instructions!
2009-12-04, 21:14:44
anonymous from Australia  
Thanks!! Great to see someone out in cyber actually answer the question with some clear practical advice. Thanks again!!
2010-01-29, 09:39:15
anonymous from India  
how to set this option for mulitple users without manually installing the digital cettificate
2010-03-02, 08:21:54
waki from Philippines  
pls help me, when i entered
makecert -r -pe -n 'CN=Your Name' -b 01/01/2000 -e 01/01/2099 -eku -ss My

on the command prompt, its a command not recognized, what will i do?
2011-10-26, 11:32:28
anonymous from United States  
How do I go about using this in a LAN? I have an SBS-2003 but I have no idea how to create a cert for Excel macros though the Cert Authority. It seems strange that I would need to imprt a cert to each PC when I have a central CA.


2012-01-28, 02:42:05
anonymous from Aberdeen, United Kingdom  
Worked beautifully - now all I have to do is find out how others can easily get it within the file I send them rather than sending it separately

2012-01-28, 13:14:52
nema36 from Iran  

2012-01-28, 13:16:18
nema36 from Iran  

2012-01-28, 13:17:42
nema36 from Iran  

This image was also posted here:
How to digitally sign Excel macros

2012-01-28, 13:19:19
nema36 from Iran
This image was also posted here:
How to digitally sign Excel macros

2012-01-28, 13:22:26
nema36 from Iran

You are on page 1 of 2, other pages: [1] 2



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: