Excel 2013 doesn't recognize add-in from Getting Started example

469 views
Skip to first unread message

chris.b...@sslmda.com

unread,
Sep 23, 2014, 2:13:53 PM9/23/14
to exce...@googlegroups.com
I tried following the Getting Started steps at http://excel-dna.net/ using F# in Visual Studio 2013 SP1 with 32-bit Excel 2013.  The "Hello world" project compiled fine.  But for step 4, when I paste the string
=SayHello("World!")
into the expression window, I get an error like
#NAME?
Tried this successively with each of the two 32-bit XLLs from my project's Debug folder loaded in Excel.  For the heck of it, I also tried each of the two 64-bit XLLs.  Got same error in all four cases.  I believe I followed the Getting Started instructions exactly.  Is there another step not in the instructions?  Does Excel 2013 require something different?  Clearly it is not recognizing the SayHello UDF, even though I have the add-in loaded per the instructions.
 
I thought I posted this issue yesterday, but it has not shown up yet, so am resubmitting.

Govert van Drimmelen

unread,
Sep 24, 2014, 2:51:03 AM9/24/14
to exce...@googlegroups.com
Hi Chris,

It sounds like your Excel is not loading the .xlls at all.
(Otherwise you'd get a clear error message when trying to load the 64-bit add-in versions, saying that Excel does not recognize the file as a valid add-in, or somthing like that).


The most likely reasons for Excel not loading add-ins at all are the Macro security settings. You can check under File -> Options, Trust Center, Trust Center Settings... and then check that the Macro Settings is anything but the "Disable all macros without notification". I like to choose the second option, "Disable all macros with notification", because Excel will actually prompt you whether to load the add-in or not, so you know you're one step further.

Another reason why Excel might fail to load the add-in is if VBA is not installed it's an optional feature, though on by default). Just press Alt+F11 and check that the VBA IDE is shown.

Finally there are some machine-specific security options, anti-virus software and such that sometimes block add-ins. But normally Excel says something about the add-in not being loaded in those cases.

-Govert



From: exce...@googlegroups.com [exce...@googlegroups.com] on behalf of chris.b...@sslmda.com [chris.b...@sslmda.com]
Sent: 23 September 2014 08:13 PM
To: exce...@googlegroups.com
Subject: [ExcelDna] Excel 2013 doesn't recognize add-in from Getting Started example

--
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 post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

chris.b...@sslmda.com

unread,
Sep 24, 2014, 2:05:09 PM9/24/14
to exce...@googlegroups.com

Thanks for the reply.  Excel 2013 was apparenty already set to "Disable macros with notification", and VBA was already installed. 
 
I got access to another machine on our network with Excel 2010, and tried the same process.  Excel 2010 gave me a complaint (which my Excel 2013 had not) to the efffect that the XLL required that the correspondingly named .dna file be added to c:\Users\{username}\AppData\Microsoft\AddIns.  When I added it, then Excel 2010 gave me the same #NAME? error I am getting with Excel 2013.
 
That this may have something to do with PC security sounds plausible.  Already spoke to one IT specialist in this area who agreed with this, but was unable to resolve.  I'll escalate to the next level.  Meanwhile, any other suggestions or info would be most welcome...
 
 

Govert van Drimmelen

unread,
Sep 24, 2014, 5:58:17 PM9/24/14
to exce...@googlegroups.com
Hi Chris,

The message you see regarding the missing .dna file probably means that when you added the add-in to Excel, the .xll file was copied to the AddIns directory, leaving the .dna file and your compiled .dll behind. I'm not completely sure when Excel decides to copy the add-in to that location - I know sometimes there is a dialog with a prompt, but it doesn't always appear. Maybe there's an Excel option that controls that.

To just check that any Excel-DNA add-in can run on the machine, I suggest you download the full Excel-DNA distribution from CodePlex: https://exceldna.codeplex.com/releases/view/119190 and unzip to a convenient location.

Then just double-click the Distribution\ExcelDna.xll file - it should load in Excel (probably with the prompt) and then give you a new function that you can call as "=AddThem(2, 3)". If this works, we know Excel-DNA works fine, and we can figure out why your add-in is not loading.

Maybe you can then try File->Open, browse to the output directory of your project and pick your <project>-addin.xll file there. It should again give you the prompt and then have the add-in loaded.

If that does not work, please write back with some details of what worked and didn't, and we can continue from there.

Regards,
Govert

chris.b...@sslmda.com

unread,
Sep 24, 2014, 6:32:46 PM9/24/14
to exce...@googlegroups.com

Thanks again, Govert -- will follow up on your suggestions.  Meanwhile, based on further experiments and discussion with a colleague here, I think this is turning out at least in part to be a Visual Studio issue with F#. I'm now curious for a little more detail on how anyone else may have successfully completed the Getting Started exercise using F# (what kind of F# project in Visual Studio, what if any additional customization needed to get the Hello World example to work with the F# project).

 

My colleague determined that your example works fine using C# in our environment, with the Visual Studio C# class library template.  Apparently VS 2013 does not come with an F# class library template.  I had created my project as an F# library, which seemed to be the closest available match, but on reflection probably does not expose the right stuff to interface with non-F# .NET code.  Found an F# class library VSIX on the web, but it does not work with VS 2013, so I am now trying to figure out how to manually create an F# class library project...

 
Regards,
Chris 

Govert van Drimmelen

unread,
Sep 24, 2014, 6:49:07 PM9/24/14
to exce...@googlegroups.com
Hi Chris,

It should work fine for F#. "Library" is the right project type.

I just tried the following steps with my Visual Studio 2013:
* Create a new F# "Library" project.
* Open the package manager console, and enter "Install-Package Excel-DNA".
* Replace all the code in Library1.fs with the snippet from the Excel-DNA readme file:

module MyFunctions

open ExcelDna.Integration

[<ExcelFunction(Description="My first .NET function")>]
let HelloDna name = 
    "Hello " + name

* Open the project properties page, pick the Debug tab, select "Start external program:" and pick Excel.exe. My path is: c:\Program Files (x86)\Microsoft Office\Office15\EXCEL.EXE

* Press F5, which runs Excel. Open a Blank Workbook.
* Press File->Open, navigate to the new project's Debug output directory, and load the TestDnaFs-AddIn.xll.
* See the prompt and say "Enable..."
* Enter =HelloDna("Chris") and it says "Hello Chris"
* A breakpoint in the "Hello " + name line works correctly.

Could you give that a try?

-Govert




Sent: 25 September 2014 12:32 AM
To: exce...@googlegroups.com
Subject: Re: [ExcelDna] Excel 2013 doesn't recognize add-in from Getting Started example

--

chris.b...@sslmda.com

unread,
Sep 25, 2014, 12:20:33 PM9/25/14
to exce...@googlegroups.com
Govert, many thanks for the detailed walk-through.  Problem solved! 
 

Govert van Drimmelen

unread,
Sep 25, 2014, 2:13:12 PM9/25/14
to exce...@googlegroups.com
Hi Chris,

What was the problem?
Maybe it could help the next guy in your position.

Cheers,
Govert


Sent: 25 September 2014 06:20 PM

To: exce...@googlegroups.com
Subject: Re: [ExcelDna] Excel 2013 doesn't recognize add-in from Getting Started example
Govert, many thanks for the detailed walk-through.  Problem solved! 
 

--

chris.b...@sslmda.com

unread,
Sep 25, 2014, 5:17:51 PM9/25/14
to exce...@googlegroups.com
Hi Govert,
 
You asked what the actual problem turned out to be.
 
What I know for sure is that following your more detailed instructions for F# above worked, while literally following the home page's Getting Started instructions for F# did not and led to my post.
 
I believe the most essential difference between the two is between the code you suggested above for Library1.fs and the corresponding code in the Getting Started section of the home page.  Your code above looks like an idiomatic F# function definition, whereas the code on the home page looks like a C# class definition.  I was surprised that Visual Studio compiled the C# class definition in an F# project with no error, but the wording of the Getting Started instructions seemed to imply that the C# class definition should work without modification in F# and it did compile successfully, so I naively thought everything was fine at that level, but then it did not work in Excel.
 
It's really nice that Excel-DNA supports direct invocation of F# functions.
 
Thanks again for your help!
Reply all
Reply to author
Forward
0 new messages