views:

35

answers:

1

I open an Excel workbook from VB.Net and then want an event in the workbook (such as pressing a button) to activate code in VB.Net. How do I accomplish this type of callback?

+1  A: 

Make the .Net assembly act as a COM object which is quite easy to use from VBA.

See this page for a comprehensive example:
http://richnewman.wordpress.com/2007/04/15/a-beginner%E2%80%99s-guide-to-calling-a-net-library-from-excel/

ho1
The link is helpful but it does not answer my question. I have a VB.NET application that opens an Excel Workbook. I want an event in the workbook to trigger some code in the same application that opened the workbook in the first place.
Should work on the same principle I think. Just make sure that the VB.Net Application that opens Excel have a COM compatible interface and register that interface properly and then the VBA should be able to connect back.
ho1