1

I have created a xll addin using ExcelDNA so that it can be easily written in C#.

I also have a VSTO and I want the VSTO to Register the xll file, so that I can use the custom functions when the user is using the VSTO plugin for excel.

This is what is written in the Addin startup method:

Application.RegisterXLL(@"SMPXLL.xll");

It would work if I wrote the absolute address of the .xll file. However, I want it to be a relative address. I just don't know what the file is relative to.

Malick
  • 6,252
  • 2
  • 46
  • 59
  • See the accepted answer [here](http://stackoverflow.com/questions/3196505/cant-load-xll-programmatically) – Jim Hewitt Jul 27 '16 at 15:32
  • @Hewitt, I m not sure that it works with a xll created by ExcelDNA because I think that in this case the xll is not pure C code. I have added the excel-dna tag (in review), maybe that Govert (author of excel-dna) will have a chance to see it. – Malick Jul 27 '16 at 16:13

1 Answers1

0

Application.RegisterXLL(...) works fine for Excel-DNA add-ins.

You can find the path of the executing assembly (the VSTO library) using code like this: How do I get the path of the assembly the code is in?

Then build the full path to the .xll file relative to that path.

Community
  • 1
  • 1
Govert
  • 16,387
  • 4
  • 60
  • 70
  • I've actually moved the .xll file to the same folder that the VSTO project's .dll is in. So does that just mean that I can just write the following? Application.RegisterXLL("SMPXLL.xll"); – Steven John Lally Jul 28 '16 at 02:07
  • Nevermind, I have solved the problem. I'm a beginner so it took me a while to really understand what was going on. Thank you so much for your help. – Steven John Lally Jul 28 '16 at 02:29