tags:

views:

115

answers:

1

Good morning,

I am about to start writing an Excel add-in for Excel 2002. The add-in needs to call a form. Obviously, I can write the form within VBA.

My question is -- is there an easy/good way of calling a .NET (I am using 3.5) from Excel, and have the form be able to write stuff back to Excel the same way a native Excel 2002 form would?

+2  A: 

Office XP... yes, functionally you can manipulate excel from add-in or the other way around, but obviously it requires more coding compared to VBA.

Most powerful solution is to use OLE automation, but it is not the easiest one to code and support. If you really need it and have this option - get something like http://www.add-in-express.com/ - it gives a nice wrapper over Excel automation and addresses most common problems. Anyway, add-in-express looks like the most mature product supporting Office XP and worth checking out to get better idea about how .Net code and Excel can interact.

There are multiple ways you can implement data exchange between Excel and .Net code in add-in: OLE automation, calls to COM functions from VBA, RTD, not sure if anyone still uses DDE. There are some setup effort, programming challenges, and maintenance/stability problems for each of those.

DK
Would this work for Excel 2002, or just some later version (which?)? I don't think I would be writing a managed add-in since I'm using 2002, but correct me if I'm wrong. I was planning to call a managed form from a VBA add-in. Very good response, however, I'm voting it up.
AlanR
Yes, this all is relevant for 2002. In Office 2003 there is VSTO, which is more natural first choice. As for "managed" term - it's relevant for implementation, but not for the deployment; you still have to expose add-in as COM. Sorry for the confusion, I'll correct the answer.
DK
MSDN link on creating managed add-ins http://support.microsoft.com/kb/302901
DK