Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

The AutomationSecurity property behavior has changed in Office 2003


View products that this article applies to.

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.

↑ Back to the top


Cause

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

↑ Back to the top


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:

Collapse this tableExpand this table
Macro TypeAutomationSecurity settingAction
XLM Low Opens workbook file and runs macros
VBA Low Opens workbook file and runs macros
LBL Low Opens workbook file and runs macros
XLM ByUI Respects macro setting in UI
VBA ByUI Respects macro setting in UI
LBL ByUI Respects macro setting in UI
XLM ForceDisable Does not open workbook file
VBA ForceDisable Opens workbook file but disables macros
LBL ForceDisable Opens workbook file but disables macros
In this table, "LBL" 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 "file open" errors, while still displaying the security warning if the "file open" succeeds.

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

↑ Back to the top


Status

This behavior is expected in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


Keywords: KB825939, kbinfo, kbsecurity, kbusage, kbmacro

↑ Back to the top

Article Info
Article ID : 825939
Revision : 4
Created on : 12/29/2005
Published on : 12/29/2005
Exists online : False
Views : 391