The problem with custom macros and VBA projects is that Microsoft Office 2010’s security features tends to err on the side of caution, giving you a warning for every single macro you’ve created every time you boot up an Office application. It’ll say something like: "Microsoft Office has identified a potential security concern. Macros have been disabled. Macros might contain viruses or other security hazards. Do not enable this content unless you trust the source of this file.”
It’s a minor annoyance, but it’s a nuisance all the same. In order to get rid of those nagging warnings, you have to get your custom macros digitally signed. Here’s how:
Step One
Click Start and open the Microsoft Office 2010 folder. Within this folder, look for the Microsoft Office 2010 Tools folder. Expand it and click Digital Certificate for VBA Projects.
Step Two
Type a name for your self-signed certificate and click OK. It doesn’t matter what you name it. Afterwards, you’ll see a message saying the digital certificate was created successfully.
Note: Office will give you this long spiel about how self-signed certificates only work on your machine, because self-signed digital signatures could be forgeries, but that doesn’t matter, since you’re making this for your own projects. However, if you do plan on distributing your custom macros, you should look into getting an authenticated code signing certificate. The Create Digital Certificate program gives you a convenient link for commercial certificate authorities, if you’re interested in going that route.
Step Three
Launch Outlook 2010, or Word 2010 or whatever Microsoft Office 2010 application you have custom macros for. Click the Developer tab and choose Visual Basic.
Step Four
Open a VBA project and click Tools and choose Digital Signatures.
Step Five
In the Digital Signature window, Click Choose…
Step Six
Select the self-signed digital certificate you just created and click OK.
Step Seven
Save your VBA project.
Step Eight
Next time you launch your Office 2010 application, you’ll get a different message that says: “Warning: This publisher has not been authenticated and therefore could not be imitated. Do not trust these credentials.” The reason it’s saying this is because it’s self-signed—you can trust it because you’re the one who made it. Click Trust all documents from this publisher and you’ll be rid of those nagging warnings forever.
And that’s all there is to it. If you ever want to remove a certificate, you can do so by opening up Control Panel > Network and Internet > Internet Options and going to the Content tab.
Click the Publishers button under Certificates.
Here, you can remove certificates by selecting them and choosing remove.
Ed
June 7, 2011 at 4:45 am
Excellent, many thanks!
MrGroove
June 7, 2011 at 7:38 am
@Ed – Your very welcome! Thanks for the feedback and I hope to see you around my blog more often!
Kashif
January 24, 2012 at 3:01 am
I loved the graphical part of this Howto’s…
Steve
December 12, 2011 at 10:17 pm
I’ve written a macro for Outlook 2010 running on my Microsoft Home Server v.1
Following the above directions for creation of a self-signed certificate, everything goes fine until I try to assign the certificate to the project in the VBA editor. My certificate doesn’t appear in the Digital Signature window, when I click on Choose, no certificates are there to choose from. I’ve confirmed in internet options that the certificate exists.
Any ideas?
Thanks
Lindsay
January 5, 2012 at 10:35 am
Fantastic step-by-step instructions and perfect screenshots. I’ve looked at several sets of instructions but this one finally makes it so easy to understand. Thank you very much.
Carl
February 11, 2012 at 2:14 pm
Maybe this works for Excel and Word, but this absolutely does NOT work for Outlook, which is VERY finicky about certs. For Outlook:
1. Make sure Macro settings (in OUTLOOK TRUST CENTER…Email security) are set to notify, and CLOSE Outlook.
2. Create cert as described above.
3. EXPORT THE CERT to file. It’s on INTERNET OPTIONS–> CONTENT –> CERTIFICATES as well.
4. Turn right around and IMPORT the cert you just exported. Sounds stupid, I know. But it gets it to the “Intermediate Certification Authorities” list. Putting it there manually using CERTMGR.MSC or otherwise caused me issues. Had to import.
5. Go into OUTLOOK and IMPORT the CERT yet AGAIN, using Outlook trust center…email security. Exit Outlook.
6. Start Outlook and NOW assign the macro to your VBA project. Save and exit. Go back into Outlook again. Run the macro, answer yes to the trust message.
7. If it does not work repeat step 6..sometimes the assignment goes away. If still no luck try the whole process again…you’ll get it working.
8. If you totally flubbed it up and macro won’t run at all, create a new cert, assign it to macro, then take it off the macro before running it. Exit Outlook and re-start.
9. Good luck. Outlook has MAJOR issues, and not just with CERTS.
Rock n Roach
October 23, 2014 at 10:34 am
Thank you Carl. Steps 3 and 4 got me up and running.
George
January 24, 2017 at 12:15 am
Carl,
You rock!
Needed all these steps for office 2016.
Amazing how Microsoft still has not fixed that…
Matt Goddard
June 12, 2018 at 2:29 pm
Hi Carl and of course Jack for the original post. I did manage to get this working early last year but recently needed to reformat the pc. I have got the macro working with no problem at all, but i cannot seem to get the nag disappear when starting outlook, the option i need to click is still greyed out. Is there anything i am missing? Could a recent windows update have messed things up? Many thanks. Matt
James Hahn
May 29, 2013 at 1:38 pm
I have a client who I write macros for. How do I copy my certificate to his machine so that my macros will run without interference on his machine as well?
Ron Bevan
August 26, 2013 at 2:03 am
Dear Jack,
Thank you so much for this excellent tutorial. I’ve previously had only one foray into the world of VB, and it was unsuccessful. This time, by contrast, was an absolute breeze and it worked right first time. Excellent. It’s also my first experience of GroovyPost, which I found when searching for a solution to my “auto bcc in Outlook 2010” problem, but it certainly won’t be my last.
Thanks again.
Matt
January 31, 2014 at 5:53 am
Hi Jack,
Thanks. Superb. Really helpful – I’ve used this to auto BCC myself every time, along with your other post.
I nearly ran aground, though, when the certificate wasn’t applied when I restarted Outlook. However, I worked out that it was because I had three windows open – mail, calendar and tasks. The way to solve it was to shut down two of those windows, apply the changes and save. I had to do it three times so each time a different one was left open – mail, then calendar, then tasks – and eventually it worked. It may have just worked first time if I closed the others and had only one open but I’ll never know.
Anyway, thanks again.
Rachel
May 23, 2014 at 5:30 pm
This was great! Thank you very much!
The only slight modification I needed to make was to get this to work was to go to my macro within Outlook and then click view certificate properties when choosing the macro then select Install certificate and save to Trusted Publishers before proceeding with Carl’s step 6 above.
Thomas Low
October 30, 2014 at 1:19 am
Is there a tool I can use to sign all my documents so that I don’t have to do it one-by-one?
I have a set of documents with macros in them and I want to be able to just run a tool to add this Self-signed certificate to those documents. There are just too many to do this by hand.
Sotwotimes
August 4, 2015 at 8:34 am
Hello Thomas,
I have the same problem , I would like to sign mor than one hundred documents. Did you find a tool or a script to do that ?
I will appreciate if you can help me :-)
Thank you
Regards,
Sofiane
Thomas Low
August 4, 2015 at 4:41 pm
No Tools was found.
Joe B
February 19, 2015 at 12:52 pm
Very helpful. Thank you.
Sotwotimes
August 4, 2015 at 8:32 am
Hello,
Sorry for my bad english but I’m french.
I need help about digital signatures.
I would like to sign many excel with my certificat. I have more than one hundred files and I don’t want to do that manually. Someone know if I can do that automatically ?
Thank you for your help,
Regards,
Soolee
October 7, 2015 at 7:51 pm
Thanks it helped lots!!! much better and greater than SUXX microsoft technical service center!!!!
They usually says after heard of my request; “SORRY sir, my department is not for that so you need to call another department”.
Erhan
November 16, 2015 at 6:16 am
Hi, this was really very simple and time efficient. Thanks a lot.
Binh
February 18, 2016 at 6:32 pm
Hi,
I face a similar situation but with document content signature, not with VBA, can you help ? it is as follows:
I received a word document signed by a self-signed certificates, and I have trusted that certificate so that it become valid in word.
Later on how can i untrust that certificate ?
Many Thanks
evan effa
July 16, 2016 at 10:17 am
Excellent Resource.
Thank you.
BTW: Office 2016 hides the Digital Certificate app in a new location:
C:\Program Files\Microsoft Office\root\Office16\SELFCERT.EXE
It works well though.
Thank you very much.
-e
Steve Krause
July 16, 2016 at 5:23 pm
Awesome @Evan – Thanks for the feedback AND for the data on Office 2016. I’ll get the article updated.