Unwanted UDF functions

Nov 27, 2012 at 4:26 PM

I Govert,

I have a very strange behaviour with Excel DNA.


I want to create several UDF in Excel. So I create a dedicate class to store the different UDF: 

Namespace MyLibrary

Public Class clsUDFFunctions
    <ExcelFunction(Description := "My first Excel-DNA function")> _
    Public Shared Function RTStats() As Object 
        Return GetStats()
    End Function
End Class
End namespace


I can use my RTStats function in XL, but also the GetStats function ... and other ones.

I thought only my RTStats() function will be exposed in XL.


Any clue?

Nov 27, 2012 at 4:47 PM
Edited Nov 27, 2012 at 4:49 PM


By default, Excel-DNA will register all "Public Shared" methods in your assembly. If you want to export only those methods explicitly marked with an <ExcelFunction> attribute, you can modify the .dna file to add an ExplicitExports attribute, so it might read:

<DnaLibrary RuntimeVersion="v4.0" >
  <ExternalLibrary Path="whatever.dll" ExplicitExports="true" />


Nov 28, 2012 at 9:34 AM

Thank you for your prompt answer.

It works fine.