Signing a Macro with a Digital Signature

3 4

For added security, you can digitally sign your macros by attaching digital certificates to them. But before you can use this security measure, you must have a digital certificate installed on your computer. For more information about obtaining and using digital certificates, see Chapter 34, "Addressing Security Issues."

After you've installed a digital certificate, you can digitally sign a macro as follows:

  1. Open the file that contains the macro project you want to sign.
  2. Choose Tools, Macro, Visual Basic Editor, or press Alt+F11.
  3. In the Project Explorer window of the VBE, select the macro project you want to sign in the Procedure drop-down list.

    Note


    You can also display a selected macro in the VBE by choosing Tools, Macro, Macros to open the Macros dialog box, selecting the macro you want to sign in the Macro Name list, and then clicking the Edit button. The VBE window opens and displays the code for the selected macro.

  4. Choose Tools, Digital Signature. The Digital Signature dialog box opens, as shown in Figure 40-12.

    figure 40-12. to help provide security, the digital signature dialog box enables you to sign your macros with a digital certificate.

    Figure 40-12. To help provide security, the Digital Signature dialog box enables you to sign your macros with a digital certificate.

  5. In the Digital Signature dialog box, perform either of the following actions:
    • If you haven't previously selected a digital certificate or want to assign a different certificate, click Choose. The Select Certificate dialog box appears, as shown in Figure 40-13. Select the certificate you want to use, and then click OK twice.
    • To use the current certificate, if one is specified, click OK.
  6. After you sign your macro, close the VBE and save your document.

    figure 40-13. the select certificate dialog box displays a list of certificates that you can use to sign your macros.

    Figure 40-13. The Select Certificate dialog box displays a list of certificates that you can use to sign your macros.

As a rule, you should digitally sign a macro only after you've completed the creation process, including testing the macro. Whenever signed code is modified, the digital signature is removed. If you have the proper digital certificate on your computer, the macro will then be automatically resigned when it is saved. As you can see, editing a signed macro causes your computer to perform extra processing. In addition, if you're working on a computer that doesn't contain your digital certificate information, modifying your macro will remove the digital certificate, and the certificate won't be reattached when you save your changes.


Changing the Security Level for Macro Virus Protection

Another security-related macro issue involves setting the security level in Word. You can specify whether you want Word to treat documents that contain macros with a high, medium, or low security level. To configure your security level, follow these steps:

  1. Choose Tools, Macro, Security.
  2. In the Security dialog box, click the Security Level tab, and then specify whether you want High, Medium, or Low security.
  3. Click OK to apply the security level.

For more information about Word's security levels and how Word handles each security level, see Chapter 34, "Addressing Security Issues."




Microsoft Word Version 2002 Inside Out
Microsoft Word Version 2002 Inside Out (Inside Out (Microsoft))
ISBN: 0735612781
EAN: 2147483647
Year: 2005
Pages: 337

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net