Signing a Macro with a Digital Signature

 < Day Day Up > 



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 28, "Addressing Document Protection and 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.

    Note 

    When you open a macro project in VBE, all the macros are shown by default. If you prefer, you can display a selected macro only 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 Edit. The VBE window opens and displays the code for the selected macro. Alternatively, you can double-click the macro project to open the macro window and then select a macro name in the Procedure list in the macro window.

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

    click to expand
    Figure 32-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 32-13. Select the certificate you want to use and then click OK. The digital certificate name displays in the Digital Signature dialog box. Click OK to close the Digital Signature dialog box.

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

    • To use the current certificate, if one is specified, click OK.

  6. After you sign your macro, close the VBE and save your document.

start sidebar
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 28, "Addressing Document Protection and Security Issues."

end sidebar

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 signed again automatically 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.



 < Day Day Up > 



Microsoft Office Word 2003 Inside Out
Microsoft Office Word 2003 Inside Out (Bpg-Inside Out)
ISBN: 0735615152
EAN: 2147483647
Year: 2005
Pages: 373

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