Search notes:

Registry: HKEY_CURRENT_USER\Software\Microsoft\Office\X.Y\Excel\Security

AccessVBOM

Setting AccessVBOM to 1 allows to access the VBA Object Model (See error message Programmatic access to Visual Basic Project is not trusted)
The following PowerShell commands can be used to add such a value:
#
# Following value is something like 'Application.Excel.16'
#
$officeVersion = (get-item hklm:\Software\Classes\excel.application\curVer).getValue('')

#
# Remove 'Application.Excel.' from / add '.0' to version string, resulting in something like '16.0'
#
$officeVersion = $officeVersion -replace '.*\.(\d+)', '$1.0'

new-itemProperty -path HKCU:\Software\Microsoft\Office\$officeVersion\Excel\Security -name 'AccessVBOM' -value 1 -force | out-null
Github repository about-Windows-Registry, path: /HKEY_CURRENT_USER/Software/Microsoft/Office/application_version/Excel/Security/enable-access-to-VBA-object-model.ps1
See also VBA – How to programmatically enable access to the VBA object model using macros.

TODO

What is the value of VBAWarnings used for?

See also

HKEY_CURRENT_USER\Software\Microsoft\Office\x.y\Excel

Index