4

Is there a way to use .Net Objects in Excel?

I’ve seen people using COM classes created using VB6 in Excel. So I’m wondering if we can use .Net objects? (without making them into COM objects)

1 Answer 1

3

2 Cases

You want to access a .NET Object you created from within Excel VBA

Requires the .NET Component to be registered for COM Interop.

You want to access a .NET Object you created from within an Excel .NET Application

Use Visual Studio Tools for Office System to create the Workbook and objects all in the same place. Very easy.

http://msdn.microsoft.com/en-us/vsto

Some more useful links of how to build COM Interop assemblies

Another Stackoverflow question with comments on this topic

A very detailed read on the ins and outs of COM Interop with .NET

Effectively, once you learn the style, you can quickly create, edit and distribute .NET assemblies to be accessed directly by Office clients.

Hope this helps

Sign up to request clarification or add additional context in comments.

4 Comments

I'm looking more for accessing .Net components in Excel VBA. Thank you for your response... maybe I need to go the COM route for now.
Writing code in .NET and accessing via COM Interop and the VBA CreateObject method is actually fairly straight forward. Hoping that you can use that standard to achieve what you want. Found some useful links I added to the bottom of my answer that may be of further research interest to you
I've done COM classes using .Net... There are problems when you need to do changes to the classes and re-deploy it to the users. Also it would mean I need to create a shell for the classes as I do not want to make the existing classes to be COM visible.
Have you looked at using VSTO? Is that even remotely a viable option? I only ask because I experience the exact same pain you describe above and we just migrated to VSTO. Really made our Office development a lot easier. Just my .01 cents

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.