Top Nav

How to Create a Self-Signed Digital Certificate in Microsoft Office 2016

One of the most compelling parts of the Microsoft Office productivity suite for power users is the ability to automate functionality using Visual Basic for Application code. Applications such as Word, Excel, and Outlook can be used to create Macros. Macros are small bits of programming code used for performing repetitive Office Settingstasks. In versions of Office before 2007, VBA support was notorious for being exploited. Since then, Microsoft has enhanced the security within the suite, limiting the impact of rogue code causing potential damage.

Previously, we showed you how to setup and configure a Self-Signed Digital Certificate in Office 2010. Since then, some things have changed in the Office 2016 release. In this article, I’m going to review Creating Self-Signed certs using the latest version of Office.

Setup Self-Signed Digital Certificate in Office 2016 Applications

The Digital Certificate for VBA Projects can now be found within Program Files > Microsoft Office > root > Office16.

digi cert o16 1

Double click the SELFCERT file, enter a name for your Digital Certificate then click OK.

digi cert o16 2

Launch any of the Office applications you would like to use the digital certificate in. For this article, I am going to use Excel. The first thing you will need to do is enable the Developer tab. Click File > Options > Customize Ribbon > check the box Developer then click OK.

digi cert o16 3

Select the Developer tab then click the Macro Security button within the Code group, select the Enable all Macros radio box then click OK.

digi cert o16 1a

Within the Code group, click Visual Basic. The Visual Basic for Applications component will be launched. Click Tools then click Digital Signature.

digi cert o16 4

Click Choose, the recently created digital certificate will be presented. Click OK then proceed to save your project.

digi cert o16 5

Ensuring your Macros Work

I noted earlier; Microsoft has made security changes to how Macros work in Office applications over the years. Saving your Macro’s are not allowed in a standard workbook or document.

Macro enabled one

Instead, users must correctly choose Macro-Enabled as the file type when saving.

Macro enabled two

Users can manage their signed certificate by using launching Internet Options. Click Start, then type: internet options, hit Enter on your keyboard, select the Content tab then click Manage Certificates. Here you have the choice of deleting or exporting your certificate for use on another computer.

manage certificates

Check out our previous example how to setup a handy Macro in Microsoft Outlook for enabling Blind Carbon Copy.

More Reading:

One Response to How to Create a Self-Signed Digital Certificate in Microsoft Office 2016

  1. Kathy April 5, 2017 at 1:08 pm #

    The main problem is that a dotm which is already signed, will keep the signature’s document variables, even if the VBA is edited and during those edits new document variables may be added. Saving the file again, your timestamping routine seems to assume that YOUR document variables are the last ones that have been added (i.e. the ID is equal to the COUNT). That may not be the case though.

    We find that a new file created from our template will crash Word when closed without saving under the condition that your document variables are not the last one in the collection (i.e. if your document variable id is equal to the count then that’s ok, if we have another one added and your’s is not the last one, then Word crashes).

    If we are adding document variables after the file has been signed for the first time and then save again (thus re-signing it), your routine re-uses the already existing document variables rather than creating new (last) ones. Therefore your document variables aren’t the last ones (which you may assume somewhere in your code?). Word crashes if we create a new file from such a template and exit the file without saving it. We can recreate this. However, we can also re-create the fix of removing the signature (and manually removing your document variables which aren’t removed when the signature is removed – shouldn’t it do that?? ). If we only remove the signature and then re-sign it after changing our VBA part and the document variables, it crashes again (suggesting that you’re re-using the variables if found). However, if we manually remove the doc variables and then re-sign, our templates remain stable and don’t crash Word.

    We can produce a file ‘Before’ and After if you would like to see what this means in reality but it would probably be a good idea to do a screen-share with someone technical to demonstrate.


Leave a Reply


Free Learning


Don't miss a single tip, how to or tech news update. Subscribe to my free newsletter and receive updates, right to your inbox.

You have Successfully Subscribed!