To use the Application.AutomationSecurity property on a computer that has Office XP installed, you must install Microsoft Office XP Service Pack 2 or a later version.
For additional information about the latest service pack for Microsoft Office XP, click the following article number to view the article in the Microsoft Knowledge Base:
AutomationSecurity propertyThe Application object of Microsoft Word, Microsoft Excel, and Microsoft PowerPoint supports this property.
This property returns or sets an MsoAutomationSecurity constant that represents the security mode that an Office XP program uses when programmatically opening files. This property is automatically set to msoAutomationSecurityLow when the program is started. Therefore, to avoid breaking solutions that rely on the default setting, be careful to reset this property to msoAutomationSecurityLow after you open a file programmatically. Also, be sure to set this property immediately before and after you open a file programmatically, to avoid malicious subversion.
This property also allows macros to choose to open a document and to trigger the appropriate security warning, which 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 case, this property does not change the settings in the Security dialog box (on the Tools menu, point to Macro, and then click Security).
The following are the MsoAutomationSecurity constants that you can choose from:
The value of the DisplayAlerts property does not apply to security warnings. For example, if the user sets the DisplayAlerts property equal to False and the AutomationSecurity property to msoAutomationSecurityByUI while the user is on the Medium security level, security warnings appear while the macro is running. This action allows the macro to trap "file open" errors, while still displaying the security warning if the "file open" succeeds.
- msoAutomationSecurityForceDisable = 3
- msoAutomationSecurityByUI = 2
- msoAutomationSecurityLow = 1
Dim secAutomation As MsoAutomationSecurity
secAutomation = Application.AutomationSecurity
Application.AutomationSecurity = msoAutomationSecurityForceDisable
Application.AutomationSecurity = secAutomation
Article ID: 317405 - Last Review: Apr 9, 2007 - Revision: 1