I am trying to call UDF in excel from C#?When I open the excel from start-->pro the UDF function works.but when I try to apply the formula from C# automation I am getting Name?# any help below is the code itried
Microsoft.Office.Interop.Excel.Application oXL = new Microsoft.Office.Interop.Excel.Application(); oXL.Visible = true; Microsoft.Office.Interop.Excel._Workbook oWB; Microsoft.Office.Interop.Excel._Worksheet oSheet;
oWB = (Microsoft.Office.Interop.Excel._Workbook)(oXL.Workbooks.Add(System.Reflection.Missing.Value));
oXL.AddIns.Add("ciqfunctions.udf", false)
Microsoft.Office.Interop.Excel.AddIn adc = oXL.AddIns.Item["Capital IQ Worksheet Functions"];
adc.Installed = true;
oXL.AddIns.Add("ciqfunctions.udf", false).Installed = true;
all below register xlls returns false.any idea
bool clloaded = oXL.RegisterXLL(@"C:\Program Files\Capital IQ\Office Plug-in\ciqfunctions.xll");
bool clloaded1 = oXL.RegisterXLL("ciqfunctions.xll");
bool clloaded2 = oXL.RegisterXLL("ciqfunctions.udf");
bool clloaded3 = oXL.RegisterXLL(oXL.DefaultFilePath + "\\CIQAddinLib.dll");
I am applying formula by creating range
and range.formula="=some udf formula" but it puts Name#? any idea
I think this line is ok and should work, almost:
at least according to my readings. Try it with the full path of the file which in your case is this one:
everything else seems to be ok, steps are also shown here:
Loading an Excel Add-in