Add a digital certificate signature for a VBA project to a WORD2003 macro

Source: Internet
Author: User

You can use Word macro commands to increase your productivity when you edit a document using Word. By default, the security setting for Word macros is high, and macros are automatically disabled when you run the Word Macro command. If you set the Word macro security to Medium, the Word Macro Security warning dialog box pops up every time you run the Word macro. If you set your Word macro security to low to suppress a security warning, you can increase the risk of malicious code or virus damage. To do this, users can add a digital certificate signature for a VBA project to a Word macro, not only to suppress Word macro security warnings, but also to not reduce the security of Word documents. Taking Word2003 as an example, the concrete implementation method is described as follows.

1. Set the security level for Word macros to "medium"

You first need to set the security of the Word macro to "medium" to see the clearer setting results. After you have signed the digital certificate for the VBA project for the Word macro, set the security to high, as described in the following steps:

Step 1th, run Word2003, and open the Word2003 window. In the menu bar, click tools → macros → Visual Basic Editor menu commands, as shown in Figure 2008061101.

Figure 2008061101 Click the Visual Basic Editor menu command

Step 2nd, open the Visual Basic Editor window, and click the Insert → module menu command in the menu bar, as shown in Figure 2008061102.

Figure 2008061102 Clicking the Module menu command

Step 3rd, open the Module window and enter three lines of code in the window:

Sub Macrodm ()

Msbox "My Macro"

End Sub

and click the "file" → "close and return to Microsoft Word" menu command on the menu bar. In the Word window, click tools → macros → security menu commands to open the Security dialog box. Select the Medium Radio box and click OK, as shown in Figure 2008061104.

Figure 2008061104 The Security dialog box

Step 4th, save and close the current Word file, and then open the Word file again. The Security Warning dialog box is automatically opened to prompt the user whether to run the Word macro, as shown in Figure 2008061105.

Figure 2008061105 Security Warning dialog box

2. Install the digital certificate for the VBA project

The digital certificate that installs the VBA project requires the Office installation CD or installation source files, as described in the following installation steps:

Step 1th, place the Office 2003 installation CD in the CD drive, and then open the Control Panel window and double-click the Add/Remove Programs icon in the Control Panel window. In the open Add or Remove Programs window, select the Microsoft Office Professional Edition 2003 option and click the Change button, as shown in Figure 2008061106.

Figure 2008061106 The Add or Remove Programs window

Step 2nd, open the Microsoft Office 2003 Installation Wizard, select the Add or Remove Features radio box in the Maintenance Mode Options dialog box, and click the Next button, as shown in Figure 2008061107.

Figure 2008061107 Selecting the Add or Remove Features radio box

Step 3rd, open the Custom Installation dialog box, select the Select Advanced Customization for application check box, and click Next, as shown in Figure 2008061108.

Figure 2008061108 Selecting the "Select Advanced customization for application" check box

Step 4th, expand the Office Shared Features option in the Advanced customization dialog box that opens, and then click the Drop-down triangle to the left of the digital certificate for VBA project. Click the run from My Computer option in the pop-up installation Options list and click the Update button to begin the installation, as shown in Figure 2008061109.

Figure 2008061109 Click the Run from My Computer option

3. Create a digital certificate for a VBA project

After the digital certificate for the VBA project is successfully installed, click the Microsoft Office tools → The digital certificates for VBA Project command in the Start menu, and then open the Create Digital Certificate dialog box. Enter the name of the digital certificate (such as wordhome.com.cn) in the "Your Certificate name" box, and click the OK button. When you successfully create a digital certificate, click OK to close the Create Digital Certificate dialog box, as shown in Figure 2008061110.

Figure 2008061110 "Create digital certificate" dialog box

4. Add a digital signature to a Word macro

To install a digital signature for a Word macro, the following steps are described:

Step 1th, open the Word file that you created beforehand that contains the Word Macro command, and click tools → macros → Visual Basic Editor menu commands in the menu bar. In the Editor window, click the tools → digital signature menu command, open the Digital Signature dialog box, and click the Select button, as shown in Figure 2008061111.

Figure 2008061111 The Digital Signature dialog box

Step 2nd, in the Open Select Certificate dialog box, select the digital certificate named wordhome.com.cn, and then click OK → OK, as shown in Figure 2008061112.

Figure 2008061112 "Select Certificate" dialog box

Step 3rd, in the Visual Basic Editor window, click the file → turn back to Microsoft Word menu command, and then reset Word macro security to high and close the Word file.

5. Always believe in macros from this publisher

Open the Word file that contains the signed Word macros, and open the Security Warning dialog box. Select the Always trust macros from this publisher check box, and click the Enable Macros button. Then close the Word file again, and when you open the Word file again, the Security Warning dialog box will no longer pop, and the Word Macro command has been run automatically, as shown in Figure 2008061113.

Figure 2008061113 Selecting the Always trust macros from this publisher check box

Note : More wonderful tutorials Please pay attention to the triple computer Tutorials section, triple Office group: 185219299 welcome you to join

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.