Search code examples
vb.netvisual-studio-2005excel-dna

Using Excel-DNA with VS2005


I'm trying to use Excel-DNA to integrate my VB.NET DLL into VBA. But I'm running into the following problem. If I try to add this line before one of my static (Shared) class functions:

<ExcelFunction(Description = "Do stuff", Category = "Useful functions")> _ 

I get a compile error saying "Name 'Description' is not declared" (and same for Category). I've got VS2005 so maybe that has something to do with it. The example given in the Excel-DNA documentation is for C# and I'm feeling that maybe I just need to get the syntax right.

I've got the needed

Imports ExcelDna.Integration

line at the beginning of my file.


Solution

  • The syntax for using attributes in VB.NET is a bit different to C#. You need to write the property assignments with ":=", something like this:

    <ExcelFunction(Description:="Do Stuff", Category:="Useful functions")>_
    ...