Prevent Excel from running XLM macros
| Registry value | xl4macrooff |
| Group Policy | Prevent Excel from running XLM macros |
| German version | Excel am Ausführen von XLM-Makros hindern |
| Intune settings catalog | Prevent Excel from running XLM macros (User) |
| Scope | User · HKCU |
| ADMX | excel16.admx · L_XL4KillSwitchPolicy |
Group Policy path
Registry
| Value | Data |
|---|---|
HKCU\Software\policies\microsoft\office\16.0\excel\security | |
| xl4macrooff | Enabled = 1 · Disabled = 0 |
Not configured = the value does not exist – the application default applies and users may change the setting.
PowerShell
Check the current value (read-only)
# --- Settings ---
$root = 'HKCU:' # other signed-in user (elevated): 'Registry::HKEY_USERS\<SID>'
$key = "$root\Software\policies\microsoft\office\16.0\excel\security"
foreach ($name in @('xl4macrooff')) {
try { '{0} = {1}' -f $name, (Get-ItemPropertyValue -Path $key -Name $name -ErrorAction Stop) }
catch { '{0}: not configured' -f $name }
}Admin rights needed: HKCU\Software\Policies is read-only for standard users. An elevated session writes to the admin's own HKCU – to set it for another signed-in user, change $root to Registry::HKEY_USERS\<SID>.
Enable
# --- Settings ---
$root = 'HKCU:' # other signed-in user (elevated): 'Registry::HKEY_USERS\<SID>'
try {
$key = "$root\Software\policies\microsoft\office\16.0\excel\security"
if (-not (Test-Path $key)) { New-Item -Path $key -Force -ErrorAction Stop | Out-Null }
New-ItemProperty -Path $key -Name 'xl4macrooff' -PropertyType DWord -Value 1 -Force -ErrorAction Stop | Out-Null # Enabled
'Done.'
}
catch { Write-Error "Failed: $($_.Exception.Message)" }Disable
# --- Settings ---
$root = 'HKCU:' # other signed-in user (elevated): 'Registry::HKEY_USERS\<SID>'
try {
$key = "$root\Software\policies\microsoft\office\16.0\excel\security"
if (-not (Test-Path $key)) { New-Item -Path $key -Force -ErrorAction Stop | Out-Null }
New-ItemProperty -Path $key -Name 'xl4macrooff' -PropertyType DWord -Value 0 -Force -ErrorAction Stop | Out-Null # Disabled
'Done.'
}
catch { Write-Error "Failed: $($_.Exception.Message)" }Reset to Not configured
# --- Settings --- $root = 'HKCU:' # other signed-in user (elevated): 'Registry::HKEY_USERS\<SID>' $key = "$root\Software\policies\microsoft\office\16.0\excel\security" Remove-ItemProperty -Path $key -Name 'xl4macrooff' -ErrorAction SilentlyContinue 'Policy values removed (Not configured).'
Intune (settings catalog)
Prevent Excel from running XLM macros (User)
Settings catalog → Add settings → search for the name above.
Intune Settings Catalog Viewer ↗
Alternative: custom profile (OMA-URI)
| OMA-URI | ./User/Vendor/MSFT/Policy/Config/excel16v6~Policy~L_MicrosoftOfficeExcel~L_ExcelOptions~L_Security~L_TrustCenter/L_XL4KillSwitchPolicy |
| Data type | String |
| Value | <enabled/> · <disabled/> |
Cloud Policy
Cloud Policy (config.office.com → Customization → Policy Management) offers many user policies of the Microsoft 365 Apps – search for Prevent Excel from running XLM macros. It also applies to unmanaged devices and wins over GPO and Intune for the same setting.
Microsoft explanation
This policy setting will prevent Excel from running Excel 4.0 (XLM) macros.
If you enable this policy setting, XLM macros cannot be run in Excel.
If you disable or don’t configure this policy setting, XLM macros can be run in Excel.
Same category: Microsoft Excel 2016 › Excel Options › Security › Trust Center
- Turn off Trusted Documents on the networkdisablenetworktrusteddocuments
- Set maximum number of trusted documentsmaxtrusteddocuments
- Set maximum number of trust records to preservemaxpreservetrusteddocuments
- Macro Notification Settingsvbawarnings
- Store macro in Personal Macro Workbook by defaultfglobalsheet_37_1
- Trust access to Visual Basic Projectaccessvbom
- Disable all application add-insdisablealladdins
- Require that application add-ins are signed by Trusted Publisherrequireaddinsig
- Disable Trust Bar Notification for unsigned application add-ins and block themnotbpromptunsignedaddin
- Turn off trusted documentsdisabletrusteddocuments
- Block macros from running in Office files from the internetblockcontentexecutionfrominternet
- Block Excel XLL Add-ins that come from an untrusted sourceblockxllfrominternet
All policies in this category · All 173 policies of excel16.admx