VBA signing Office 2k & XP VBA Macros

Signing Microsoft Office 2k & XP VBA Macros with a Digi-Sign Digi-Code™

This document details the process needed to sign Microsoft Office 2K & XP VBA macros with a Digi-Sign Digi-Code™ certificate including a worked example. All web links are provided for illustration purposes only, and are correct at time of publishing. It is recommended that the user checks for any updates that may become available since the publishing of this document.



Download the PVK import tool from Microsoft (pvkimport.exe).

Obtain your code signing certificate from Digi-Sign here.


    1. Install pvkimport you downloaded from Microsoft. Remember the paths to where you installed it (c:\codesign\). You may also copy your certificate and key files to this directory (mycert.spc & mykey.pvk).

    2. Open a command-prompt and change to the folder where you installed pvkimport. (c:\codesign\).

    3. Combine your SPC and PVK certificate/key files that you received from Digi-Sifn into a PFX file using pvkimport: (c:\codesign> pvkimprt –pfx c:\codesign\mycert.spc c:\codesign\mycert.pvk)
    This will start a wizard.

    Enter a password [PIN Code]
    Choose options:

    4. Install your Digi-Code™ certificate in Windows registry.

    5. You can check the private key has been imported successfully by using MMC. Open MMC, select add/remove snap in and select certificates for your personal certificate store. Opening your code signing certificate should show code signing usage and that you have the private key corresponding to the certificate.

    6. Within your MS Office document, open the Visual Basic editor from the Tools – Macro

    7. Open the VBA project you wish to sign, and select Digital Signature from the Tools menu.

    8. Select Chose from the Digital Signature window and choose your code signing certificate that you
    wish to use to sign your VBA macro.

    9. Click OK followed by Save, close to return to your Office document. Your macro is now digitally signed.