title: Call Outlook VBA code from c#
body: <p>In visual studio I am creating an addin, in the addin_startup I am setting an Outlook application to </p>
  
  <pre><code>app = (Microsoft.Office.Interop.Outlook.ApplicationClass)(Marshal.GetActiveObject("Outlook.Application"));
  </code></pre>
  
  <p>then I am calling a runMacro function which I got from msdn</p>
  
  <pre><code>private void RunMacro(object oApp, object[] oRunArgs)
  {
     try
     {
  
          oApp.GetType().InvokeMember("Run", System.Reflection.BindingFlags.InvokeMethod, null, oApp, oRunArgs);
     }
     catch (Exception e)
     {
          MessageBox.Show(e.GetType().ToString());
  
      }
  }
  </code></pre>
  
  <p>I pass this function, my Outlook app object and the name of the macro to run in an array, as so...</p>
  
  <pre><code>RunMacro(app, new Object[] { "showFormDisplay" });
  </code></pre>
  
  <p>I get the following exception </p>
  
  <pre><code>Unknown name. (Exception from HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))
  </code></pre>