Frequently Asked Questions

Code Signing Microsoft Office Macros and Visual Basic for Applications

Print this Article
Last Updated: May 1, 2015 9:26 AM

A code signing certificate can be used to sign content produced by several Microsoft® Office applications such as Word®, Excel® and PowerPoint®.

Before you get started, make sure the code signing certificate and private key are in the Windows certificate store. Refer to Installing Code Signing Certificate in Windows for installation instructions.

To Code Sign Documents

  1. Open the file you want to sign.
  2. Click the Tools menu, highlight Macro and click Visual Basic Editor.
  3. In the Project Explorer window, select the VBA macro project that you want to sign.
  4. From the Tools menu, select Digital Signature.
  5. Click Choose and select your Code Signing Certificate.
  6. Click OK to close.

By default, Windows® XP and Windows 7 do not add a time stamp to the certificate.

If you would like to allow people to continue using your signed Visual Basic® for Applicaions (VBA) code after the certificate expires, modify the registry on your code-signing computer to add a time stamp at the time of signing using the following keys:

  • Create Key: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security
  • Create String: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security\TimeStampURL
  • Create DWORD: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security\TimeStampRetryCount
  • Create DWORD: HKEY_CURRENT_USER\Software\Microsoft\VBA\Security\TimeStampRetryDelay
  • Set the new fields to these values:
    TimeStampURL = http://tsa.starfieldtech.com
    TimeStampRetryCount = 3
    TimeStampRetryDelay = 2