views:

107

answers:

1

I know this question has been posted before... but I haven't found any answer yet (besides from the generic answers about how XLL are actually DLL, etc). Has anybody out there been successful calling a XLL from say C# (using DllImport) without having to load Excel with the XLL loaded as an addin?

Basically, you would have to create a special XLCALL32.DLL that simulates the Excel host. It sounds like a lot of work... has anybody done this? Or seen a product to do it?

Thanks

A: 

You're on the right track with needing to create your own XLCall32.dll and simulate Excel. That's non-trivial given what you can do via the interface that XLLs use to talk to Excel. It becomes easier the less of Excel that you need to use from within your XLL, so I guess if you have a known selection of XLLs that you need to use and you know what bits of Excel they access via the XLL interface then you can just replace the bits you need...

Why do you want to do this?

Len Holgate
i have an XLL I wrote a while back. I lost the source code. And I'd love to be able to call it's functions from c#.
Nestor
IMHO, it would be easier for you to rewrite the XLL in a form that you can call from C# than it would be to write a substitute XLCall32.dll and simulate Excel... Then again I guess that depends on how much you were using Excel to do your work, but I expect you can remember that so you should at least know which parts of Excel you need to simulate. Then there's the just the question of loading the xll, marshalling your c# types to the appropriate XLOPERs and calling the entry points...
Len Holgate