Running an excel macro from NAV 2013

stevdebstevdeb Member Posts: 13
edited 2014-12-17 in NAV Three Tier
Hi,

I am not so experienced in .net yet. So my excuses if I ask stupid things.

I want to execute an excel macro out of NAV 2013 R2 and I use 2 variables for this:

Name DataType Subtype Length
XlApp DotNet Microsoft.Office.Interop.Excel.ApplicationClass.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
NullGbl DotNet System.Object.'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

I cannot compile my NAV object if I do not add 30 parameters to the "run" function so I use the "NullGbl" variable for this:
  XlApp.Run('CreateSubtotals',NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,
   NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl,NullGbl);

"CreateSubtotals" is the name of the macro. When executing the code, I get an error from excel that it does not expect so many parameters:



And indeed, the macro has no parameters, but NAV does not compile if I don't add them :( .

Any ideas?

Thanks,
Steven
Sign In or Register to comment.