Excel 2 macrosheets and add-in files: registry value xl2macrosUserHKCU\software\policies\microsoft\office\16.0\excel\security\fileblock
- Policy ID
- L_Excel2MacrosheetsAndAddInFiles
- Scope
- User Configuration
- Supported on
- At least Windows Server 2008 R2 or Windows 7
- Source
- Microsoft 365 Apps / Office Administrative Templates (version 5568.1000)
- Category
- Microsoft Excel 2016 › Excel Options › Security › Trust Center › File Block Settings
Registry
xl2macros
REG_DWORDUser- Enabled value
- Depends on the option value
- Element
- File block setting:
| Item | Stored value |
|---|---|
| Do not block | 0 |
| Open/Save blocked, use open policy | 2 |
| Block | 3 |
| Open in Protected View | 4 |
| Allow editing and open in Protected View | 5 |
Apply with .reg · CMD · PowerShell
.reg
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\software\policies\microsoft\office\16.0\excel\security\fileblock] ; Options (use only one) ; Do not block "xl2macros"=dword:00000000 ; Open/Save blocked, use open policy "xl2macros"=dword:00000002 ; Block "xl2macros"=dword:00000003 ; Open in Protected View "xl2macros"=dword:00000004 ; Allow editing and open in Protected View "xl2macros"=dword:00000005
CMD
:: Options (use only one) :: Do not block reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "xl2macros" /t REG_DWORD /d 0 /f :: Open/Save blocked, use open policy reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "xl2macros" /t REG_DWORD /d 2 /f :: Block reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "xl2macros" /t REG_DWORD /d 3 /f :: Open in Protected View reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "xl2macros" /t REG_DWORD /d 4 /f :: Allow editing and open in Protected View reg add "HKCU\software\policies\microsoft\office\16.0\excel\security\fileblock" /v "xl2macros" /t REG_DWORD /d 5 /f
PowerShell
# Common: create the key New-Item -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Force | Out-Null # Options (use only one) # Do not block New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'xl2macros' -PropertyType DWord -Value 0 -Force | Out-Null # Open/Save blocked, use open policy New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'xl2macros' -PropertyType DWord -Value 2 -Force | Out-Null # Block New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'xl2macros' -PropertyType DWord -Value 3 -Force | Out-Null # Open in Protected View New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'xl2macros' -PropertyType DWord -Value 4 -Force | Out-Null # Allow editing and open in Protected View New-ItemProperty -Path 'HKCU:\software\policies\microsoft\office\16.0\excel\security\fileblock' -Name 'xl2macros' -PropertyType DWord -Value 5 -Force | Out-Null