PRB: ActiveX Control Events Are Not Handled When the Excel Macro Security Level Is Set to High (824007)
The information in this article applies to:
- Microsoft Office Excel 2003
- Microsoft Visual Studio Tools for the Microsoft Office System version 2003
SYMPTOMSWhen you start Microsoft Office Excel, and you open a workbook that uses a managed code extension, you may receive a message similar to the following: Macros are disabled because the security level is set to High and a digitally signed Trusted Certificate is not attached to the macros. To run the macros, change the security level to a lower setting (not recommended), or request the macros be signed by the author using a certificate issued by a Certificate Authority. The workbook then opens in Design Mode, and any managed code event handlers for Microsoft ActiveX controls in the workbook will not run. CAUSE
This behavior occurs when the following are true: - The macro security level in Excel is set to High.
-and- - The workbook contains a Microsoft Visual Basic for Applications (VBA) project that has not been digitally signed.
When the macro security level is set to High, any workbook that contains a VBA project that has not been digitally signed must open in Design Mode. WORKAROUND
To work around this behavior, use one of the following methods.
Method 1: Add a Digital Signature to the Macro
Excel runs macros that are signed by a trusted source. Obtain a digital signature, and then add the digital signature to the macro. To add the digital signature:
- 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 Project Explorer, click the project that you want to sign.
-
On the Tools menu, click Digital Signature.
-
Click Choose, click the certificate, and then click OK. Click OK again to close the Digital Certificate dialog box.
Method 2: Change the Macro Security Level
To change the macro security level:
-
On the Tools menu, click Options.
-
Click the Security tab.
-
Under Macro Security, click Macro Security, and then
click the Security Level tab.
-
On the Security Level tab, click the security level that you want to use, and then click OK two times.
For more information about macro security, click
Microsoft Excel Help
on the
Help
menu. Type
about macro security
in the
Search
text box of
Assistance. Click
Search. Method 3: Remove the VBA Code from the WorkbookIf the functionality that your VBA code provides has a managed code equivalent, you can transition this functionality to the managed code extension. After you have transitioned the code, you can remove all the modules and code that the workbook's VBA project contains. When you use this method, you avoid the security warning and the workbook does not open in Design Mode when the Excel macro security level is set to High. If you cannot completely remove the VBA project from your workbook, you can move only the worksheets in the workbook to a new workbook. REFERENCES
For additional information about how to obtain and use digital signatures, click the following article numbers to view the articles in the Microsoft Knowledge Base:
217221
OFF2000: Using SelfCert to Create a Digital Certificate for VBA Projects
206637 OFF2000: Overview of Digital Certificates
Modification Type: | Minor | Last Reviewed: | 2/3/2006 |
---|
Keywords: | kbprb KB824007 kbAudDeveloper |
---|
|