Hi Gert-Jan,
Thank you for trying Excel-DNA, even though the documentation is fragmented and sparse.
For a VB.NET function to be registered with Excel it must either be a Function in a Public Module, or it must be a Public Shared Function in a Public Class.
It’s easy to put the code in a Class but forget to mark the function as “Shared” (the equivalent of “static” in C#).
The simplest instructions for a VB.NET add-in would be:
· Create a new “Class Library” project.
· Install the “ExcelDna.AddIn” package from NuGet.
· Replace everything your .vb file with this code:
Imports ExcelDna.Integration
Public Module MyFunctions
<ExcelFunction(Description:="My first .NET function")> _
Public Function HelloDna(name As String) As String
Return "Hello " & name
End Function
End Module
· Press F5 to compile and load in Excel.
· Now check for the =HelloDna("Gert-Jan") in a cell
Let us know whether you are able to get it to work.
Regards,
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 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.
--
You received this message because you are subscribed to a topic in the Google Groups "Excel-DNA" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/exceldna/dXDTEbdH4ks/unsubscribe.
To unsubscribe from this group and all its topics, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.