title: Error when calling VBA function from VSTO code
body: <p>I have the following VBA code in a module of one of my .xlt files:</p>
  
  <pre><code>Public Sub SetShapeTop(ByVal shapeName As String, ByVal topValue As Single)
    ThisWorkbook.ActiveSheet.Shapes(shapeName).Top = topValue
  End Sub
  </code></pre>
  
  <p>In my VSTO add-in, I have the following C# code which tries to call that VBA function:</p>
  
  <pre><code>m_worksheet.Application.Run("SetShapeTop", kv.Key, kv.Value, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
    Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
  </code></pre>
  
  <p>That line throws an exception, as follows:</p>
  
  <pre><code>(Excerpt from my log4net logs)
  
  [Exception: COMException]
  {Target: Cluster Report}
  {Invoked Method: Macro execution}
  {Target Method: Cluster Report}
  {Parameters: }
  {Message: Cannot run the macro 'SetShapeTop'. The macro may not be available in this workbook or all macros may be disabled.}
  {Stack trace: 
  Server stack trace: 
  
  
  Exception rethrown at [0]: 
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
    at Microsoft.Office.Interop.Excel._Application.Run(Object Macro, Object Arg1, Object Arg2, Object Arg3, Object Arg4, Object Arg5, Object Arg6, Object Arg7, Object Arg8, Object Arg9, Object Arg10, Object Arg11, Object Arg12, Object Arg13, Object Arg14, Object Arg15, Object Arg16, Object Arg17, Object Arg18, Object Arg19, Object Arg20, Object Arg21, Object Arg22, Object Arg23, Object Arg24, Object Arg25, Object Arg26, Object Arg27, Object Arg28, Object Arg29, Object Arg30)
    at MSA.Excel.ClusterPresenter.RenderReport(IReportData reportData, IResponseReportParameters reportParams, Worksheet worksheet) in C:\workspace\MSABasketlink\2.0\MSA.Library.UI\Presentation\ClusterPresenter.cs:line 647} 
  </code></pre>
  
  <p>Am I missing something here?  If anyone can point me in the right direction, I'd really appreciate it...! </p>