Code Signing Microsoft Office Macros and Visual Basic for Applications
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
- Open the file you want to sign.
- Click the Tools menu, highlight Macro and click Visual Basic Editor.
- In the Project Explorer window, select the VBA macro project that you want to sign.
- From the Tools menu, select Digital Signature.
- Click Choose and select your Code Signing Certificate.
- Click OK to close.
Note: 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