I have developed a simple C# Winforms application that loads MS-Word 2007 documents via COM automation.
This is all very simple and straight forward, however depending on the document I need to programamtically Enable or Disable Macros as well as ActiveX controls.
There is probably a way to store this in the registry, but I want to control these settings on an instance by instance basis as multiple concurrent requests may be running at a time.
So my question is 'how do I configure the trust center settings using COM automation'.
I have Googled for hours, but all I have been able to find is the Application.AutomationSecurity property, but this only accepts the following values:
The Word 2007 Trust Center however exposes the following settings:
Macro Settings:
(source: visguy.com)
ActiveX controls (configured separately, I have not found any way to control these, note that according to the screenshot these settings are shared between all applications)
I have tried the old trick of recording an MS-Word macro while changing these settings, but none of these steps are recorded.
Update: I have found the following entries for the ActiveX controls settings in the registry. Looks like ActiveX settings are indeed global and cannot be specified for a single MS-Word instance unless someone proves me wrong.
ActiveX Disabled
[HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Security] "DisableAllActiveX"=dword:00000001 "UFIControls"=dword:00000002
ActiveX Enabled with safe mode
[HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Security] "DisableAllActiveX"=dword:00000000 "UFIControls"=dword:00000002
ActiveX Enabled without safe mode
[HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Security] "DisableAllActiveX"=dword:00000000 "UFIControls"=dword:00000001
Still keen to resolve the macro settings problem
Looks like I am going to answer my own question.
I have tested it and can confirm the mappings are as follows:
Macro Settings:
msoAutomationSecurityForceDisable = Disable all macros without notification
msoAutomationSecurityByUI = Disable all macros except digitally signed macros
msoAutomationSecurityLow = Enable all macros
To the best of my knowledge the global ActiveX settings can only be configured by directly editing the registry
ActiveX Disabled
[HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Security] "DisableAllActiveX"=dword:00000001 "UFIControls"=dword:00000002
ActiveX Enabled with safe mode
[HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Security] "DisableAllActiveX"=dword:00000000 "UFIControls"=dword:00000002
ActiveX Enabled without safe mode
[HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Security] "DisableAllActiveX"=dword:00000000 "UFIControls"=dword:00000001
I have left a comment in the relevant section of the MSDN website