Skip to content

Instantly share code, notes, and snippets.

@williamknows
williamknows / Invoke-HideVBAModule.psm1
Created November 6, 2017 06:55
PowerShell cmdlet for hiding VBA modules in Microsoft Office documents
<#
.Synopsis
Used to hide VBA modules from the VBA editor in Microsoft Office documents/templates, but still have them contain executable code.
Script created by William Knowles. @william_knows
Technique originally found by Thegrideon Software: https://www.thegrideon.com/vba-internals.html
.Description
This cmdlet facilitates editing the Word/Excel documents/templates to remove references to VBA modules.
For the older compatibility formats you can edit the file directly with a hex editor and remove module references.
For the newer XML formats that use zip files, you need to unzip them, and edit the vbaProject.bin file.