Error occurs on some functions: "Programmatic access to Visual Basic project is not trusted"

This error is caused by a security option in Excel meant to deliberately lock out programmatic access to Microsoft Visual Basic for Applications (VBA) unless a user chooses to permit such access.

To resolve:

  1. Open a blank workbook in Excel.
  2. Go to File > Options > Trust Center
  3. Click on Trust Center Settings... 
  4. Under Macro Settings, make sure Trust access to the VBA project object model is checked. 


An alternative is to the registry:  HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Security, AccessVBOM=1 (REG_DWORD)

Created with the Personal Edition of HelpNDoc: Easy CHM and documentation editor