Skip to Content

Trusted VBA Code

If you have VBA coding in AO workbook the most annoying message is:

What happend?

Excel is by default configured to decline all VBA code inside of your workbook. In this specific case Excel asks the user if he wants to enable the macros for a specific workbook. That’s a session related prompt and you will be asked again to enable the content.

To change that behavior you have to open the Macro Settings

(Options => Trust Center => Trust Center Settings => Macro Settings)

Obviously the last option is the easiest one, BUT with least security.

The option to sign the macros sounds like the most interesting one. But how to do that?

At first you need a certificate. Open the tool “Digital Certificate for VBA Projects”

(In Microsoft Windows XP, on the Windows Start menu, point to All Programs, point to Microsoft Office Tools, and then click Digital Certificate for VBA Projects. In Microsoft Windows 2000, on the Windows Start menu, point to Programs, point to Microsoft Office Tools, and then click Digital Certificate for VBA Projects.)


As you can read here you can use this type of certificate only to test it locally, for using it in your company you have to use one of the commercial certificates provided via the link.

In case you want this certificate as a trusted certificate follow the guide “Adding certificates to the Trusted Root Certification Authorities store for a local computer“ here http://technet.microsoft.com/en-us/library/cc754841.aspx#BKMK_addlocal

After your certificate is created, open your VBA project. Go to “Tools”->”Digital Signature”.

With "Choose" you can select your certificate:


After that the certificate is selected. You can save the document.

After opening the document you will get ONCE the following security warning:

After "YES" you will never get bothered again.

Tags:

No comments