title: Programatically create Excel instance and load all add-ins
body: <p>I am creating an instance of Microsoft Excel in a .NET application (WPF if it matters) and I am embedding it inside like this :</p>
  
  <pre><code>        var excelType = Type.GetTypeFromProgID("Excel.Application");
          var excelObj = Activator.CreateInstance(excelType);
          excelType.InvokeMember("Visible", BindingFlags.SetProperty, null, excelObj, new object[] { true }, ComCulture);
          var excelHwnd = new IntPtr((int)excelType.InvokeMember("Hwnd", BindingFlags.GetProperty, null, excelObj, new object[0], ComCulture));
          var managedWindowHwnd = new WindowInteropHelper(Application.Current.MainWindow).Handle;
          SetParent(excelHwnd, managedWindowHwnd);
          MoveWindow(excelHwnd, 0, 0, Convert.ToInt32(Width), Convert.ToInt32(Height), true);
  </code></pre>
  
  <p>All works except Excel does not load the add-ins installed. If I run Excel via the start menu it loads the add-ins.</p>
  
  <p><strong>I guess I need to specify some arguments to Excel to enable the add-ins loading. But I have no idea what/how...</strong></p>