How to rebuild a dll file for C# from an available dll file used in Excel addin?

Please help me to rebulid a dll file for C# from a dll file used in Excel addin tool.
I have created an Excel addin tool several years ago from m-file. That is, I have a dll file for runing the tool in Microsoft Excel.
Now I want to recreat the Excel addin tool as a standalone tool.
For this purpose, I need to recreat a dll file for C# from the available current dll file used in the Excel addin tool.
I am looking forward for your kind help.

Respuestas (1)

Hi,
I doubt this will work since BUILDER EX generated DLL can be called from EXCEL only (checked / requiered inside of that generated DLL). One can't even get it to work when called from VBS:
Dim y
Set MCLUtil = CreateObject("MWComUtil.MWUtil7.16")
Set Class1 = CreateObject("xlmagic.Class1.1_0")
Call Class1.mymagic(1, y, 2)
This won't work. I tried in C# with late binding which resulted in a member not found exception:
Type tmp;
object MCR;
object dll;
object x = null;
tmp = Type.GetTypeFromProgID("MWComUtil.MWUtil7.16");
MCR = Activator.CreateInstance(tmp);
tmp = Type.GetTypeFromProgID("xlmagic.Class1.1_0");
dll = Activator.CreateInstance(tmp);
try{
tmp.InvokeMember("mymagic", BindingFlags.SetProperty, null, dll, new object[] { 1, 2, x });
}
catch (Exception ex){
Console.WriteLine(ex);
Console.Read();
return;
}
Console.WriteLine(x);
The only way around would be to start excel (from C#), which opens a worksheet which calls the DLL. Pretty ugly but no other way is possible.
Easiest way would be to recompile the MATLAB code with the Builder NE which generates you a .NET DLL.

Preguntada:

el 2 de En. de 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by