A little bit lost, starting with Excel-DNA....

92 views
Skip to first unread message

Ulrich

unread,
Apr 19, 2021, 6:57:42 AM4/19/21
to Excel-DNA

Hi there,
I'm a little bit lost, getting Excel-DNA running, while trying to build my first Visual Studio Project.
I'm quite versed using VBA (for years..), but never tried to use VB.NET until now.
My .NET Code seems to be ok (no errors) and works fine in Excel, when debugging ist with the "Run-Button" in Microsoft Visual Studio Community 2019.
But how the hell do I get the Code running independentlyin Excel?

Obviously I don't understand the advices correctly.
I compiled my Code within VS2019 and got .dll, .xll and .dna files. No errors.
What hast to be done next??
Importing the .xll into Excel leads to an error, that the file has the wrong format.

Any help for me how to start?
Thanks in advance
Ulrich

Govert van Drimmelen

unread,
Apr 19, 2021, 7:13:05 AM4/19/21
to exce...@googlegroups.com

Hi Ulrich,

 

In your output directory there is a mixture of files.

 

I think you’ll see:

 

    MyLibrary.dll – your code is in here

    MyLibrary.xml – descriptions etc. for your code, not used here

    MyLibrary.pdb – debug information for your code

 

    MyLibrary-AddIn.xll – 32-bit not-packed add-in loader

    MyLibrary-AddIn.dna – 32-bit not-packed add-in definition

 

    MyLibrary-AddIn64.xll – 64-bit not-packed add-in loader

    MyLibrary-AddIn64.dna – 64-bit not-packed add-in definition

 

    MyLibrary-AddIn-packed.xll – 32-bit packed single-file add-in (is like MyLibrary-AddIn.xll with MyLibrary.dll and MyLibrary-AddIn.dna packed inside it)

 

    MyLibrary-AddIn64-packed.xll – 64-bit not-packed single-file add-in (is like MyLibrary-AddIn64.xll with MyLibrary.dll and MyLibrary-AddIn64.dna packed inside it)

 

 

So in the one output directory you have not-packed and packed versions of the add-in, for both 32-bit and 64-bit versions of Excel.

 

The first thing you need to know when running your add-in somewhere, is whether the Excel installation is 32-bit or 64-bit.

If you get this wrong, you’ll get the “file format and extension don’t match” error.

You can check this by opening Excel and going File -> Account -> About Excel and looking at the top.

 

If your Excel is 32-bit, then you have two options:

  • Open the not-packed add-in, which is MyLibrary-AddIn.xll. This only works if the matching .dna file and your .dll library are in the same directory.
  • Open the packed add-in, which is MyLibrary-AddIn-package.xll. This should work in a directory on its own, with no other dependencies.

 

Similarly for 64-bit Excel, you use the corresponding AddIn64 files.

 

For debugging, things work better with the not-packed versions. So that’s what runs when you debug.

 

But it’s nicer to give someone else the single-file packed version.

 

If your library has other dependencies, say you also have MyCalculations.dll.

Then you need to tell Excel-DNA that this files should also be packed.

For this you add a <Reference …/> entry into your project’s MyLibrary-AddIn.dna file.

 

Please ask if you have more questions.

I’m happy to help, even though I can’t point to great documentation yet.

 

-Govert

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/fbbcf680-ad4c-4e1b-bd17-180c189adc3fn%40googlegroups.com.

Ulrich

unread,
Apr 19, 2021, 7:27:17 AM4/19/21
to Excel-DNA
Hi Govert,
things can be so simple when you understand them....
Thank you very much for your advices.
Yes!, I works.
I actually didn't pay attention to the fact that I had to take the 64bit versions.

Thank you!
Reply all
Reply to author
Forward
0 new messages