RegisteredFunctions in C# fails when trying to get the list of addins and function

R

Robin

Hello
I am using a small C# program which uses the office interop and tries
to get the list of addin in a worksheet, but it always returns a
System.DBNull but if I write a small VBA procedure it always succeeds
any ideas or thoughts, I have attach a the code been executed in C#.

using System;
using Microsoft.Office.Core;
using System.Runtime.InteropServices;
using System.Reflection;
using System.Windows.Forms;

namespace ExcelRangeRunMacro
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
RunTest();
Console.ReadLine();
}

private static void RunTest()
{
Excel._Application xlApplication = null;
Excel._Workbook workbook = null;

//Start Excel and get Application object.
xlApplication = (Excel.Application) new Excel.Application();
xlApplication.Visible = true;
workbook =
(Excel._Workbook)(xlApplication.Workbooks.Open(@"H:\Personal\abc_mod.xls", Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing));

xlApplication.Visible = true;
xlApplication.UserControl = true;

object olist2 = xlApplication.get_RegisteredFunctions(Type.Missing,
Type.Missing);
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top