views:

879

answers:

4

hi i am using vs2008+vsto to create excel add in (ribbon)... is it possible to make it a dll, like myaddin.dll so that users will have to only add this dll... and use, or can you suggest any better approach, thanks a lot!

A: 

As far as I know, an Excel addin has to be an xla/xlam file. You could have a dll called from the xla, but you'll still need the xla.

Tamar
A: 

You can do it by writing your Excel add-in in C# as a COM automation object. Then, when you go to the Add-Ins dialog in Excel you can select a COM object or browse to a Com .dll. Excel will create an instance of the objects that you can then call.

Sean
Are you completely sure? As far as I understand it code running in Excel needs elevated permissions and GAC suscription.
Wilhelm
I'm positive! I've written and deployed a component this way. There are a couple of registry keys required but that's about it...
Sean
+1  A: 

Yes, you can. However, dlls used in Excel need to be suscribed in the GAC and some registry keys need to be changed (basically telling Excel where to find the dll). So it is best to use a setup to install the dll. The process is somewhat complicated an it is best described here and continued here.

Wilhelm
A: 

To correct the above comments...

  1. GACing the assembly is not necessary, however registering the assembly for COM automation is necessary. As stated above this is most easily achieved using the MSDN doco on EXCEL Com addins and a setup project for deploying the required keys. The advantage to strongly naming and GACing the assembly is that it will be fully trusted, this may be an easier way (for some ppl) of getting around permission exceptions (than using CAS). However in practise unless you are selling your addin externally this is not a show stopper.

  2. XLA/XLAM is not necessary, it is an alternative to using a COM Addin (either VB6, c++ or .net) XLA is a lighter weight option if you wish to quickly develop and build a solution.

Anonymous Type