Code that is written to automate an Office application and programmatically manipulate the Microsoft Visual Basic for Applications (VBA) environment and object model may fail on Office with one of the following error messages:
From Visual Basic or VBA:
From Visual Basic or VBA:
Run-time error '6068': Programmatic Access to Visual Basic Project is not trusted
From Microsoft Visual C++, Microsoft Foundation Classes (MFC), or ActiveX Template Library (ATL): HRESULT = 0x800A17B4 (-2146822220) "Programmatic Access to Visual Basic Project is not trusted"
The same code works without error on computers with Office 97 and Office 2000.