Automation Security
Explanation
This policy setting controls whether macros can run in an Office 2016 application that is opened programmatically by another application.
If you enable this policy setting, you can choose from three options for controlling macro behavior in Excel, PowerPoint, and Word when the application is opened programmatically:
- Disable macros by default - All macros are disabled in the programmatically opened application.
- Macros enabled (default) - Macros can run in the programmatically opened application. This option enforces the default configuration in Excel, PowerPoint, and Word.
- User application macro security level - Macro functionality is determined by the setting in the "Macro Settings" section of the Trust Center.
If you disable or do not configure this policy setting, when a separate program is used to launch Microsoft Excel, PowerPoint, or Word programmatically, any macros can run in the programmatically opened application without being blocked.
Registry
HKEY_CURRENT_USER\software\policies\microsoft\office\common\security- Value name
- not defined in the ADMX
Enable / disable values: not defined in the ADMX (see the options below).
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.
Enable
# Enable: office16/L_AutomationSecurity
$k = 'HKCU:\software\policies\microsoft\office\common\security'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# Set the Automation Security level
# Possible options:
# Disable macros by default = 3
# Use application macro security level = 2
# Macros enabled (default) = 1
Set-ItemProperty -Path $k -Name 'automationsecurity' -Value 1 -Type DWordDisable
# Disable: office16/L_AutomationSecurity
# No value is written in the "Disabled" state (nothing defined in the ADMX)Revert to "Not configured"
# Revert to "Not configured": office16/L_AutomationSecurity
$k = 'HKCU:\software\policies\microsoft\office\common\security'
Remove-ItemProperty -Path $k -Name 'automationsecurity' -ErrorAction SilentlyContinueOptions (1)
| Label | Control | Registry value | REG type | Constraints / details | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Set the Automation Security levelL_SettheAutomationSecuritylevel | Drop-down listenum | automationsecurity | REG_DWORD | Default choice (UI): #2
|
Application
Microsoft 365 Apps / Office (Microsoft) — November 2026 templates
Official templates downloaded on November 12, 2026.