tags:

views:

74

answers:

2

I need to call some .NET code from Excel 2007, and I'm searching for the best way.

The official "Microsoft-sanctioned" method seems to involve Visual Studio 2008 Professional, but I don't have that. I have VS2005, but that plus VSTO 2005 SE can only do application-level add-ins, not document-level macros.

The problem involves some analysis code that comes as .NET assemblies; I'd like to manipulate it by changing some cells in an Excel worksheet.

Any other ideas?

+2  A: 

You could expose your .net objects as COM objects, then call them from VBA...

The last post in this link has some code:

http://bytes.com/groups/ms-access/205532-calling-c-net-dll-vba

Shane Cusson
+1  A: 

You can (easily) call any COM components from VBA; you can also (less easily) call other DLLs etc. - even system DLLs.

If you create a COM wrapper for your .NET DLLs you'd be able to call those from VBA. You can do that with VS2005, but the amount of work involved will depend on the complexity of the DLLs' API.

Gary McGill