I am trying to automate MS Word from my C# app and have a problem changing the ribbon UI. All samples I could find are using IRibbonExtensibility interface which is available from Addins only. Is it possible to do this using automation?
What I did was to build small ATL Addin which implements 2 Interfaces: IDTExtensibility2 and IRibbonExtensibility The customization XML is simply loaded from file.
Inside the C# code the coding is really simple:
RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Office\Word\Addins\RibbonLoaderLib.RibbonLoader");
key.SetValue("LoadBehavior",2,RegistryValueKind.DWord);
key.SetValue("Description","Ribbon Loader Add-In",RegistryValueKind.String);
key.SetValue("FriendlyName","Ribbon Loader Add-In",RegistryValueKind.String);
wordApp_.COMAddIns.Item("RibbonLoaderLib.RibbonLoader").Connect = true;