S0mbre Posted January 9, 2011 Posted January 9, 2011 Here's a small command-line (console-run) tool to get/set the macro security levels and VBOM (Visual Basic Object Model) access mode for popular MS Office applications, including Word, Excel, PowerPoint, Access and Outlook. Currently only MS Office versions 2003 (11.0) and 2007 (12.0) are supported, but the script can easily be expanded to incorporate other versions. The script comes with a command-line help file (TXT) which can be compiled into the EXE or placed in the script dir. HELP FILE CONTENTS: --------------------- Reg values used --------------------- Macro security level (DWORD): 1 (0x00000001)=low (enable all macros), 2 (0x00000002)=medium (warn user), 3 (0x00000003)=high (disable all macros) Access to Visual Basic Object Model (VBOM) (DWORD): 1 (0x00000001)=access granted, 0 (0x00000000)=access dented --------------------- MS Office 2003 (11.0) Registry Keys --------------------- WORD: Macro security: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\security\Level VBOM access: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\security\AccessVBOM EXCEL: Macro security: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\security\Level VBOM access: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\security\AccessVBOM ACCESS: Macro security: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Access\security\Level VBOM access: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Access\security\AccessVBOM POWERPOINT: Macro security: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\PowerPoint\security\Level VBOM access: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\PowerPoint\security\AccessVBOM OUTLOOK: Macro security: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\security\Level VBOM access: <NOT PROVIDED> --------------------- MS Office 2007 (12.0) Registry Keys --------------------- WORD: Macro security: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Security\VBAWarnings VBOM access: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Security\AccessVBOM EXCEL: Macro security: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security\VBAWarnings VBOM access: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security\AccessVBOM ACCESS: Macro security: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\VBAWarnings VBOM access: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\AccessVBOM POWERPOINT: Macro security: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\PowerPoint\Security\VBAWarnings VBOM access: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\PowerPoint\Security\AccessVBOM OUTLOOK: Macro security: HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Security\Level VBOM access: <NOT PROVIDED> --------------------- Command line parameters: --------------------- Command enumeration: ---- core commands (1st parameter passed) get - get data (output to stdout) set - set data ---- ms office applications (2nd parameter passed) -w OR -word - get/set value(s) for MS Word -e OR -excel - get/set value(s) for MS Excel -a OR -access - get/set value(s) for MS Access -p OR -powerpoint - get/set value(s) for MS PowerPoint -o OR -outlook - get/set value(s) for MS Outlook ---- values to get or set (parameters 3 to 5) -ov - get application version (only used with 'GET') -s OR -security=... - get/set macro security level: ; - 1=low (enable all) ; - 2=medium (warn user) ; - 3=high (disable all) -v OR -vbom=... - get/set VBOM (VBA Object Model) access - UNAVAILABLE IN OUTLOOK ; - 1=access granted ; - 0=access dented --------------------- Calling scheme: --------------------- [square brackets] denote optional parameters Vertical|separator denotes interchangeable parameters/values GET DATA: OfficeMacroSecurity.exe get -w[ord]|-e[xcel]|-a[ccess]|-p[owerpoint]|-o[utlook] [ [-ov] [-s[ecurity]] [v[bom]] ] SET DATA: OfficeMacroSecurity.exe set -w[ord]|-e[xcel]|-a[ccess]|-p[owerpoint]|-o[utlook] [-s[ecurity]=1|2|3] [-v[bom]=0|1] --------------------- Examples: --------------------- OfficeMacroSecurity.exe set -w[ord] -s[ecurity]=1 -v[bom]=1 -- For MS Word, set macro security = 1 (low) and VBOM access = 1 (enable) OfficeMacroSecurity.exe set -w[ord] -s[ecurity]=2 -- For MS Word, set macro security = 2 (medium), do not change VBOM access OfficeMacroSecurity.exe get -w[ord] -- For MS Word, get (show) all the available settings (version, security level, VBOM access) OfficeMacroSecurity.exe get -e[xcel] -v[bom] -- For MS Excel, get (show) the current VBOM access OfficeMacroSecurity.exe get -a[ccess] -ov -- For MS Access, get (show) the current application version (e.g. "12.0" = 2007) OfficeMacroSecurity_EN.au3
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now