views:

47

answers:

2

Hi,

The traders are lazy and they don't want to switch applications to hit buttons. When they hit the button in Excel, it should be the same as hitting another button in my WinForms app (which pops up a dialog box). Doable?

+1  A: 

Yes.

You need to put your functionality into a [ComVisible(true)] DLL and add a reference to it in VBA.

Alternatively, you can write an Excel addin in C#.

SLaks
A: 
  1. Write a COM server that communicates with the WinForms app using the inter-process communication mechanism of your choice
  2. Add an Excel button to the sheet
  3. Write some VBA to call the COM server

It would be nice to expose a COM object directly from the WinForms app in such a way that you can call it through the VBA GetObject function. However, I can't see an obvious way to expose an object to the COM running object table from .NET.

Tim Robinson