tags:

views:

1017

answers:

2

Hey all

Is it possible to create worksheet functions dynamically in C#, that is, without using the method attribute approach? Or is this something that's only supported using an XLL?

What I'm looking at achieving is to retrieve a functions list (along with parameters) from a source and register these functions. These functions will just serve as a call to a server, so the content of these functions is not of any major concern.

Thanks for your inputs!

A: 

Hi,

Your scenario is supported by ExcelDna (on CodePlex or Google Groups), a free library to create Excel user-defined function add-ins with .Net. It also allows you to create the exported functions and macros on the fly. These functions can either be in an assembly you locate and load with reflection, or you can generate the functions on the fly using DynamicMethods.

However, ExcelDna is implemented as an .xll add-in, which has several advantages over the Automation Add-Ins. So this does not exactly answer your question. It should be possible to create and register an automation add-in using reflection but I'm not sure what the advantage over the ExcelDna implementation would be.

--Govert--

Govert
A: 

Turns out, its not.

Only an XLL add-in gives you the ability to register functions at runtime.

ak86