views:

105

answers:

2

I have the professional versions of VS2008 & VS2010.

I wish to add a couple buttons to a toolbar in Excel. When they are clicked I'd like to be able to open a form (either WinForms or WPF is fine) collect a few values from the user in the form and then take that data + read cell values from the current worksheet to perform some database operations.

What's currently the best way to do this using C#? I'd greatly appreciate a pointer to any examples / tutorials. My understanding is that VS2010 has improved the process alot but I may have to deal w/ Excel 2003 which I don't think it supports.

I get confused between Visual Studio 2008s Extensibility->Shared Addin template and other Office Addin templates I've seen. I'm not sure when which type of solution is appropriate.

I'm new to Office development so I'd really appreciate any help to get me going on the right track.

Thanks much.

+1  A: 

A couple of starting points:

Also, you want to explore .NET Excel Wrapper

.NET Excel wrapper was born out of frustration from working with .NET and Excel. The documentation for .NET Interop.Excel is very scarce and the API is bloated with hard to understand parameters and methods that throw unknown errors.

What .NET Excel Wrapper aims to do is take the complexity out of working with Excel in .NET and increase your productivity, improve code readability and reduce the amount of code you need to write.

KMan
A: 

The default approach to extend office using .Net is VSTO. VSTO does support Excel/Office 2003; if you chose an Office 2003 project in Visual Studio, it will support 2003 and above, but by supporting 2003 you will be giving up some features which you can use if you target Office 2007 and above - like the ribbon or custom task panes.
Besides the links mentioned by KMan, I have a series of posts on my blog which provide a walkthrough for creating a Excel 2007 add-in with VSTO, which you might find useful.

Mathias