AutomationSecurity Property

Returns or sets an MsoAutomationSecurity constant that represents the security mode Microsoft Excel uses when programmatically opening files.
This property is automatically set to msoAutomationSecurityLow when the application is started.
Therefore, to avoid breaking solutions that rely on the default setting, you should be careful to reset this property to msoAutomationSecurityLow after programmatically opening a file.
Also, this property should be set immediately before and after opening a file programmatically to avoid malicious subversion. Read/write.
Setting ScreenUpdating to False does not affect alerts and will not affect security warnings.
The DisplayAlerts setting will not apply to security warnings.
For example, if the user sets DisplayAlerts equal to False and AutomationSecurity to msoAutomationSecurityByUI, while the user is on Medium security level, then there will be security warnings while the macro is running.
This allows the macro to trap file open errors, while still showing the security warning if the file open succeeds.

Sub Security() 
    Dim secAutomation As MsoAutomationSecurity

    secAutomation = Application.AutomationSecurity

    Application.AutomationSecurity = msoAutomationSecurityForceDisable

    Application.AutomationSecurity = secAutomation

End Sub

Registry Entries

The following registry entry contains the list of recently used workbooks


© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext