Sign Files

Any files that contain code for use by others should be signed with a digital signature. Chapter 1 showed you how to self-sign macros so that the code you create for your own use can run without a security warning. If others try to run code that you signed in that way, they will see a warning that the certificate can’t be verified (Figure 6-8).

Self-signed macros aren’t trusted on other users’ machines

Figure 6-8. Self-signed macros aren’t trusted on other users’ machines

Other users can’t choose to trust macros that you’ve self-signed because they can’t be authenticated through a certificate authority.

To create code that others can choose to trust:

  1. Get a digital signature from a certificate authority, such as Verisign , Inc., or CAcert.org .

  2. In Visual Basic, sign your code with that digital signature (Tools → Digital Signature → Choose).

  3. Save and close the file.

There are several types of digital signatures , which are also called digital IDs or certificates. You’ll need one that permits code signing. Other types are used to sign email messages or to identify web servers online. Licenses for digital signatures used to be very cheap, but they’ve gone up to several hundred dollars a year—which is a significant expense for an individual. For a company with multiple developers, this expense is less significant since a company generally uses the same digital signature to sign all of its published code, which distributes the cost.

Lower-cost ...

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.