Sambhaji
Sambhaji

Reputation: 1010

Creating add-in for Excel using C#

I want to use C# class methods in Excel. Can anybody guid me how to do it ? The C# component will be excel add-in. How to create setup for this addin, so that I just need to give setup to user which will install add-in at client's machine. User should not need to do any other steps like registering the C# dll.

Upvotes: 26

Views: 60354

Answers (4)

Govert
Govert

Reputation: 16907

(Disclaimer: I develop the Excel-Dna library.)

You should have a look at Excel-Dna - http://excel-dna.net. The library allows managed assemblies written in C#, VB.NET or F# to expose high-performance user-defined functions (UDFs) and macros to Excel through the native .xll interface. The project is open-source and freely allows commercial use.

With Excel-Dna you can create a single .xll add-in file that the user can open as an add-in without any further installation or registration. Excel-Dna add-ins can expose RTD servers and customized Ribbons for Excel 2007 and Excel 2010 without additional registration, so you need no extra setup program.

Upvotes: 42

Richard Ev
Richard Ev

Reputation: 54087

You will need to create a new Visual Studio project of type Excel 2007 Add-In (or Excel 2003 Add-In). The option for this can be found (in Visual Studio 2008) at:

New Project dialog -> Project types -> Visual C# -> Office

This Add-In will need to be installed on the target machine(s).

The Add-In will be able to hook into the Excel object model and therefore access any loaded spreadsheets etc.

The Add-In will also be able to add buttons to the Excel toolbar/ribbon.

Upvotes: 13

Adam Ralph
Adam Ralph

Reputation: 29956

You can create Excel projects within Visual Studio (previously known as Excel VSTO projects) or you can use a third party library such as ExcelDna.

Upvotes: 1

James Bloomer
James Bloomer

Reputation: 5322

Try looking at VSTO, there's a section explicitly for Excel

Upvotes: 6

Related Questions