Block macros from running in Office files from the internet
Cette stratégie n'a pas de traduction française dans les modèles de l'éditeur ; le texte original est en anglais.
Explication
This policy setting allows you to block macros from running in Office files that come from the internet.
If you enable this policy setting, macros are blocked from running, even if "Enable all macros" is selected in the Macro Settings section of the Trust Center. Users will receive a notification that macros are blocked from running.
The exceptions when macros will be allowed to run are:
- The Office file is saved to a Trusted Location.
- The Office file was previously trusted by the user.
- Macros are digitally signed and the matching Trusted Publisher certificate is installed on the device.
If you disable this policy setting, the settings configured in the Macro Settings section of the Trust Center determine whether macros run in Office files that come from the internet.
If you don’t configure this policy setting, macros will be blocked from running. Users will receive a notification telling them of the security risks of macros from the internet along with a link to learn more.
For more information, see https://go.microsoft.com/fwlink/p/?linkid=2185771.
Cas d'usage
Bloque les macros VBA dans les fichiers Office provenant d’Internet (marqués Mark of the Web) : l’utilisateur voit un bandeau « Risque de sécurité » sans bouton d’activation du contenu. Dans Excel, c’est une protection essentielle contre les classeurs piégés reçus par courrier ou téléchargés, tout en conservant les macros des classeurs enregistrés dans un emplacement approuvé, signés par un éditeur approuvé ou débloqués.
Microsoft recommande d’activer ce paramètre (il fait partie de la baseline de sécurité Microsoft 365 Apps for enterprise) ; les macros légitimes doivent venir d’un emplacement approuvé, être signées ou être débloquées, par exemple avec Unblock-File. Ces stratégies exigent Microsoft 365 Apps for enterprise.
Source Microsoft : Macros from the internet are blocked by default in Office
Registre
HKEY_CURRENT_USER\software\policies\microsoft\office\16.0\excel\security- Nom de la valeur
blockcontentexecutionfrominternet
| État | Valeur écrite |
|---|---|
| Activé | REG_DWORD = 1 |
| Désactivé | REG_DWORD = 0 |
PowerShell
Commandes PowerShell qui écrivent dans le registre ce que la stratégie écrirait. Les valeurs entre chevrons (<…>) sont à remplacer.
Écrire directement dans le registre contourne la stratégie de groupe : si une GPO gère cette valeur, elle sera réécrite au prochain gpupdate ; sinon la valeur reste en place (effet « tatouage »). Préférez une GPO ou, en local, LGPO.exe. Exécutez PowerShell en administrateur pour HKLM. Certaines stratégies demandent un redémarrage ou gpupdate /force.
Activer
# Activer : excel16/L_BlockMacroExecutionFromInternet
$k = 'HKCU:\software\policies\microsoft\office\16.0\excel\security'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'blockcontentexecutionfrominternet' -Value 1 -Type DWordDésactiver
# Désactiver : excel16/L_BlockMacroExecutionFromInternet
$k = 'HKCU:\software\policies\microsoft\office\16.0\excel\security'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'blockcontentexecutionfrominternet' -Value 0 -Type DWordRevenir à « Non configuré »
# Revenir à « Non configuré » : excel16/L_BlockMacroExecutionFromInternet
$k = 'HKCU:\software\policies\microsoft\office\16.0\excel\security'
Remove-ItemProperty -Path $k -Name 'blockcontentexecutionfrominternet' -ErrorAction SilentlyContinueApplication
Microsoft 365 Apps / Office (Microsoft) — modèles de novembre 2026
Modèles officiels téléchargés le 12 novembre 2026.