Digitally sign your macro project
This article describes how you can digitally sign a macro project by using a certificate. If you don't already have a digital certificate, you must obtain one. To test macro projects on your own computer, you can create your own self-signing certificate by using the Selfcert.exe tool.
Obtain a digital certificate for signing
You can obtain a digital certificate from a commercial certificate authority (CA) or from your internal security administrator or information technology (IT) professional.
To learn more about certificate authorities that offer services for Microsoft products, see the list of Microsoft root certificate program members.
Your macro projects and Microsoft Office
Because a digital certificate that you create isn't issued by a formal trusted certificate authority, macro projects that are signed by using such a certificate are known as self-signed projects. Microsoft Office trusts a self-signed certificate only on a computer that has the self-signing certificate added to the Trusted Root Certification folder in the Certificates - Current User store.
To learn how to create a self-signing certificate, see the next section.
Create a self-signing certificate
- What version of Windows are you using?
- Windows 10
- Windows 8
- Windows 7, Windows Vista, or Windows XP
-
Go to C:\Program Files (x86)\Microsoft Office\root\.
-
Click SelfCert.exe. The Create Digital Certificate box appears.
-
In the Your certificate's name box, type a descriptive name for the certificate.
-
Click OK.
-
When the SelfCert Success message appears, click OK.
-
Go to C:\Program Files\Microsoft Office\<Office version>\.
-
Click SelfCert.exe. The Create Digital Certificate box appears.
-
In the Your certificate's name box, type a descriptive name for the certificate.
-
Click OK.
-
When the SelfCert Success message appears, click OK.
-
Click Start, point to All Programs, click Microsoft Office, click Microsoft Office Tools, and then click Digital Certificate for VBA Projects.
The Create Digital Certificate box appears. -
In the Your certificate's name box, type a descriptive name for the certificate.
-
Click OK.
-
When the SelfCert Success message appears, click OK.
To view the certificate in the Personal Certificates store, do the following:
-
Open Internet Explorer.
-
On the Tools menu, click Internet Options, and then click the Content tab.
-
Click Certificates, and then click the Personal tab.
Digitally sign a macro project in Excel, PowerPoint, Publisher, Visio, Outlook, or Word
-
Open the file that contains the macro project that you want to sign.
-
On the Developer tab, in the Code group, click Visual Basic.
Note: If the Developer tab is not available: Click the File tab. Click Options. Click Customize Ribbon. In the Customize the Ribbon list, click Developer, and then click OK.
-
In Visual Basic, on the Tools menu, click Digital Signature.
-
The Digital Signature dialog appears.
-
Select a certificate and click OK.
Note: If you haven't selected a digital certificate or want to use another, click Choose. Select a certificate and click OK.
Notes:
-
It is recommended that you sign macros only after your solution has been tested and ready for distribution: when code in a signed macro project is changed in any way, its digital signature is removed. However, if you have the valid digital certificate that was previously used to sign the project on your computer, the macro project is automatically re-signed when you save it.
-
If you want to prevent users of your solution from accidentally changing your macro project and invalidating your signature, lock the macro project before you sign it. Your digital signature implies that you guarantee the project has not been tampered with since you signed it. Your digital signature does not prove that you wrote the project. Therefore, locking your macro project doesn't prevent another user from replacing the digital signature with another signature. Corporate administrators can re-sign templates and add-ins so that they can control what users run on their computers.
-
If you create an add-in that adds code to a macro project, your code should determine if the project is digitally signed and should notify the users of the consequences of changing a signed project before they continue.
-
When you digitally sign macros, it is important to obtain a time stamp so that other users can verify your signature if the certificate used for the signature has expired, or has been revoked after signing. If you sign macros without a time stamp, the signature remains valid during the validity period of your certificate.
-
Obtain a digital certificate for signing
You can obtain a digital certificate from a commercial certificate authority (CA) or from your security administrator.
To learn more about certificate authorities that offer services for Microsoft products, see the list of Microsoft root certificate program members.
Create your own digital certificate for self-signing
Because a digital certificate that you create isn't issued by a formal certificate authority, macro projects that are signed by using such a certificate are referred to as self-signed projects. Microsoft Office trusts a self-signed certificate only on a computer that has that certificate in your Personal Certificates store.
- Which version of Windows are you using?
- Windows Vista
- Windows XP
-
Click the Start button, point to All Programs, click Microsoft Office, click Microsoft Office Tools, and then click Digital Certificate for VBA Projects. In the Your certificate's name box, type a descriptive name for the certificate.
-
When the certificate confirmation message appears, click OK.
To view the certificate in the Personal Certificates store, do the following:
-
Open Internet Explorer.
-
On the Tools menu, click Internet Options, and then click the Content tab.
-
Click Certificates, and then click the Personal tab.
-
Click the Start button, point to All Programs, point to Microsoft Office, point to Microsoft Office Tools, and then click Digital Certificate for VBA Projects. In the Your certificate's name box, type a descriptive name for the certificate.
-
When the certificate confirmation message appears, click OK.
To view the certificate in the Personal Certificates store, do the following:
-
Open Windows Internet Explorer.
-
On the Tools menu, click Internet Options, and then click the Content tab.
-
Click Certificates, and then click the Personal tab.
Digitally sign a macro project
-
Open the file that contains the macro project that you want to sign.
-
On the Developer tab, in the Code group, click Visual Basic.
If the Developer tab is not available, click the Microsoft Office Button , and then click Excel Options. Then click Popular, and then select the Show Developer tab in the Ribbon check box.
Note: The Ribbon is part of the Microsoft Office Fluent user interface.
-
-
In the Visual Basic Project Explorer, select the project that you want to sign.
-
On the Tools menu, click Digital Signature.
-
Do one of the following:
-
If you haven't previously selected a digital certificate or want to use another one, click Choose, select the certificate, and then click OK twice.
-
To use the current certificate, click OK.
Notes:
-
Sign macros only after your solution has been tested and is ready for distribution, because whenever code in a signed macro project is changed in any way, its digital signature is removed. However, if you have the valid digital certificate that was previously used to sign the project on your computer, the macro project is automatically re-signed when you save it.
-
If you want to prevent users of your solution from accidentally changing your macro project and invalidating your signature, lock the macro project before you sign it. Your digital signature says only that you guarantee that the project has not been tampered with since you signed it. Your digital signature does not prove that you wrote the project. Therefore, locking your macro project doesn't prevent another user from replacing the digital signature with another signature. Corporate administrators can re-sign templates and add-ins so that they can control exactly what users can run on their computers.
-
If you create an add-in that adds code to a macro project, your code should determine if the project is digitally signed and should notify the users of the consequences of changing a signed project before they continue.
-
When you digitally sign macros, it is important to obtain a timestamp so that other users can verify your signature even after the certificate used for the signature has expired. If you sign macros without a timestamp, the signature remains valid only for the validity period of your certificate.
-
-
-
Open the file that contains the macro project that you want to sign.
-
On the Tools menu, point to Macro, and then click Visual Basic Editor.
-
-
In the Visual Basic Project Explorer, select the project that you want to sign.
-
On the Tools menu, click Digital Signature.
-
Do one of the following:
-
If you haven't previously selected a digital certificate or want to use another one, click Choose, select the certificate, and then click OK twice.
-
To use the current certificate, click OK.
Notes:
-
Sign macros only after your solution has been tested and is ready for distribution, because whenever code in a signed macro project is changed in any way, its digital signature is removed. However, if you have the valid digital certificate that was previously used to sign the project on your computer, the macro project is automatically re-signed when you save it.
-
If you want to prevent users of your solution from accidentally changing your macro project and invalidating your signature, lock the macro project before you sign it. Your digital signature says only that you guarantee that the project has not been tampered with since you signed it. Your digital signature does not prove that you wrote the project. Therefore, locking your macro project doesn't prevent another user from replacing the digital signature with another signature. Corporate administrators can re-sign templates and add-ins so that they can control exactly what users can run on their computers.
-
If you create an add-in that adds code to a macro project, your code should determine if the project is digitally signed and should notify the users of the consequences of changing a signed project before they continue.
-
When you digitally sign macros, it is important to obtain a timestamp so that other users can verify your signature even after the certificate used for the signature has expired. If you sign macros without a timestamp, the signature remains valid only for the validity period of your certificate.
-
-
-
Open the file that contains the macro project that you want to sign.
-
On the Developer tab, in the Code group, click Visual Basic.
If the Developer tab is not available, click the Microsoft Office Button , and then click PowerPoint Options. Then click Popular, and then select the Show Developer tab in the Ribbon check box.
Note: The Ribbon is part of the Microsoft Office Fluent user interface.
-
-
In the Visual Basic Project Explorer, select the project that you want to sign.
-
On the Tools menu, click Digital Signature.
-
Do one of the following:
-
If you haven't previously selected a digital certificate or want to use another one, click Choose, select the certificate, and then click OK twice.
-
To use the current certificate, click OK.
Notes:
-
Sign macros only after your solution has been tested and is ready for distribution, because whenever code in a signed macro project is changed in any way, its digital signature is removed. However, if you have the valid digital certificate that was previously used to sign the project on your computer, the macro project is automatically re-signed when you save it.
-
If you want to prevent users of your solution from accidentally changing your macro project and invalidating your signature, lock the macro project before you sign it. Your digital signature says only that you guarantee that the project has not been tampered with since you signed it. Your digital signature does not prove that you wrote the project. Therefore, locking your macro project doesn't prevent another user from replacing the digital signature with another signature. Corporate administrators can re-sign templates and add-ins so that they can control exactly what users can run on their computers.
-
If you create an add-in that adds code to a macro project, your code should determine if the project is digitally signed and should notify the users of the consequences of changing a signed project before they continue.
-
When you digitally sign macros, it is important to obtain a timestamp so that other users can verify your signature even after the certificate used for the signature has expired. If you sign macros without a timestamp, the signature remains valid only for the validity period of your certificate.
-
-
-
Open the file that contains the macro project that you want to sign.
-
On the Tools menu, point to Macro, and then click Visual Basic Editor.
-
-
In the Visual Basic Project Explorer, select the project that you want to sign.
-
On the Tools menu, click Digital Signature.
-
Do one of the following:
-
If you haven't previously selected a digital certificate or want to use another one, click Choose, select the certificate, and then click OK twice.
-
To use the current certificate, click OK.
Notes:
-
Sign macros only after your solution has been tested and is ready for distribution, because whenever code in a signed macro project is changed in any way, its digital signature is removed. However, if you have the valid digital certificate that was previously used to sign the project on your computer, the macro project is automatically re-signed when you save it.
-
If you want to prevent users of your solution from accidentally changing your macro project and invalidating your signature, lock the macro project before you sign it. Your digital signature says only that you guarantee that the project has not been tampered with since you signed it. Your digital signature does not prove that you wrote the project. Therefore, locking your macro project doesn't prevent another user from replacing the digital signature with another signature. Corporate administrators can re-sign templates and add-ins so that they can control exactly what users can run on their computers.
-
If you create an add-in that adds code to a macro project, your code should determine if the project is digitally signed and should notify the users of the consequences of changing a signed project before they continue.
-
When you digitally sign macros, it is important to obtain a timestamp so that other users can verify your signature even after the certificate used for the signature has expired. If you sign macros without a timestamp, the signature remains valid only for the validity period of your certificate.
-
-
-
Open the file that contains the macro project that you want to sign.
-
On the Tools menu, point to Macro, and then click Visual Basic Editor.
-
-
In the Visual Basic Project Explorer, select the project that you want to sign.
-
On the Tools menu, click Digital Signature.
-
Do one of the following:
-
If you haven't previously selected a digital certificate or want to use another one, click Choose, select the certificate, and then click OK twice.
-
To use the current certificate, click OK.
Notes:
-
Sign macros only after your solution has been tested and is ready for distribution, because whenever code in a signed macro project is changed in any way, its digital signature is removed. However, if you have the valid digital certificate that was previously used to sign the project on your computer, the macro project is automatically re-signed when you save it.
-
If you want to prevent users of your solution from accidentally changing your macro project and invalidating your signature, lock the macro project before you sign it. Your digital signature says only that you guarantee that the project has not been tampered with since you signed it. Your digital signature does not prove that you wrote the project. Therefore, locking your macro project doesn't prevent another user from replacing the digital signature with another signature. Corporate administrators can re-sign templates and add-ins so that they can control exactly what users can run on their computers.
-
If you create an add-in that adds code to a macro project, your code should determine if the project is digitally signed and should notify the users of the consequences of changing a signed project before they continue.
-
When you digitally sign macros, it is important to obtain a timestamp so that other users can verify your signature even after the certificate used for the signature has expired. If you sign macros without a timestamp, the signature remains valid only for the validity period of your certificate.
-
-
-
Open the file that contains the macro project that you want to sign.
-
On the Developer tab, in the Code group, click Visual Basic.
If the Developer tab is not available, click the Microsoft Office Button , and then click Word Options. Then click Popular, and then select the Show Developer tab in the Ribbon check box.
Note: The Ribbon is part of the Microsoft Office Fluent user interface.
-
-
In the Visual Basic Project Explorer, select the project that you want to sign.
-
On the Tools menu, click Digital Signature.
-
Do one of the following:
-
If you haven't previously selected a digital certificate or want to use another one, click Choose, select the certificate, and then click OK twice.
-
To use the current certificate, click OK.
Notes:
-
Sign macros only after your solution has been tested and is ready for distribution, because whenever code in a signed macro project is changed in any way, its digital signature is removed. However, if you have the valid digital certificate that was previously used to sign the project on your computer, the macro project is automatically re-signed when you save it.
-
If you want to prevent users of your solution from accidentally changing your macro project and invalidating your signature, lock the macro project before you sign it. Your digital signature says only that you guarantee that the project has not been tampered with since you signed it. Your digital signature does not prove that you wrote the project. Therefore, locking your macro project doesn't prevent another user from replacing the digital signature with another signature. Corporate administrators can re-sign templates and add-ins so that they can control exactly what users can run on their computers.
-
If you create an add-in that adds code to a macro project, your code should determine if the project is digitally signed and should notify the users of the consequences of changing a signed project before they continue.
-
When you digitally sign macros, it is important to obtain a timestamp so that other users can verify your signature even after the certificate used for the signature has expired. If you sign macros without a timestamp, the signature remains valid only for the validity period of your certificate.
-
-
No comments:
Post a Comment