Microsoft KB Archive/825939

= The AutomationSecurity property behavior has changed in Office 2003 =

Article ID: 825939

Article Last Modified on 12/29/2005

-

APPLIES TO


 * Microsoft Office Excel 2003
 * Microsoft Office Professional Edition 2003

-





SYMPTOMS
When you try to open a workbook file in Microsoft Office Excel 2003 that contains a macro that opens another workbook file, you may experience the following symptoms:  If the AutomationSecurity property is set to the ByUI value, you may receive the following message:

This workbook contains one or more Microsoft Excel 4.0 macros. These macros may contain viruses or other harmful code. These macros will be disabled.

 If the AutomationSecurity property is set to the ForceDisable value, the workbook opens, but any Microsoft Visual Basic for Applications (VBA) and XLM macros that occur in defined names are automatically disabled. If the AutomationSecurity property is set to the ForceDisable value and the workbook contains XLM ply macros, the workbook does not open.

However, in Microsoft Excel 2002 you can still open the workbook and run a macro although the AutomationSecurity property is set to the ForceDisable value.



CAUSE
This issue occurs because the behavior of the AutomationSecurity property has changed in Microsoft Office 2003.



MORE INFORMATION
By default, in Office 2003 the AutomationSecurity property is set to low. In Microsoft Office XP, you can run a macro to open a workbook even though the AutomationSecurity property is set to the ForceDisable value, or if the macro security is set to medium. However, if you use the ForceDisable value in Excel 2003, XLM macros are disabled.

If you configure the AutomationSecurity property to the ByUI value in Excel 2003, and the macro security is set to medium, you will receive a message that prompts you to enable or to disable macros in the workbook. If you configure the AutomationSecurity property to the ByUI value, and macro security is set to high, VBA and XLM labels are automatically disabled. However, workbooks that contain XLM ply macros will not open.

Note The AutomationSecurity property overrides the security that is set in the user interface. To determine the macro security in the user interface (UI), on the Tools menu, point to Macro, and then click Security.

The following table provides an overview of the behavior of the AutomationSecurity property in Excel 2003:

In this table, &quot;LBL&quot; is an Excel 4 XLM macro that is stored in a defined name.

The AutomationSecurity property
The Application object of Microsoft Word, Microsoft Excel, and Microsoft PowerPoint supports this property.

The AutomationSecurity property returns or sets an MsoAutomationSecurity value that represents the security mode that an Office 2003 program uses when it programmatically opens files. This property is automatically set to a value of MsoAutomationSecurityLow when the program starts. Therefore, to avoid breaking solutions that rely on the default setting, reset this property to the MsoAutomationSecurityLow value after you open a file programmatically. Also, make sure that you set this property immediately before and after you open a file programmatically to avoid malicious subversion.

The AutomationSecurity property also permits macros to choose to open a document and to trigger the appropriate security warning. This action is the same as if an end user is manually opening the document. This new property does not affect the behavior when the end user uses the user interface (UI) to open files. In this scenario, this property does not change the settings in the Security dialog box (on the Tools menu, point to Macro, and then click Security).

You can choose from the following MsoAutomationSecurity values:
 * MsoAutomationSecurityLow
 * MsoAutomationSecurityForceDisable
 * MsoAutomationSecurityByUI

The MsoAutomationSecurityLow value turns on all macros and is the default value when you start the program. The MsoAutomationSecurityForceDisable value disables all macros in all files that are opened programmatically, and no security warnings appear. The MsoAutomationSecurityByUI value uses the security setting that is controlled in the Security dialog box.

The value of the DisplayAlerts property does not apply to security warnings. For example, if the following conditions are true, security warnings appear while the macro is running:
 * You configure the DisplayAlerts property equal to false and the AutomationSecurity property to the MsoAutomationSecurityByUI value.
 * The user's security is set to medium.

This action permits the macro to trap &quot;file open&quot; errors, while still displaying the security warning if the &quot;file open&quot; succeeds.

You can use the following values for the DisplayAlerts property:
 * 3 = MsoAutomationSecurityForceDisable
 * 2 = MsoAutomationSecurityByUI
 * 1 = MsoAutomationSecurityLow



STATUS
This behavior is expected in the Microsoft products that are listed in the &quot;Applies to&quot; section.

Additional query words: msoAutomationSecurityLow msoAutomationSecurityForceDisable msoAutomationSecurityByUI

Keywords: kbinfo kbmacro kbsecurity kbusage KB825939

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.