How to call EDNA function in Excel using a VB script

Jun 27, 2011 at 10:21 AM

Hi,

I created a C# class library with Excel DNA integrated. I can see all the function in excel work sheet & working perfectly, but i want is to access this function in Excel VBA. Does any one know how to call those functions from a VB script in excel.

I have added the .dll file to the .net assembly using gacutil, and registered it using regasm to get it visible in excel.

how can i call this function in excel VBA button click event?

Thank you.

Coordinator
Jun 27, 2011 at 10:50 AM

Hi,

The easiest way to call your functions from VBA is to use Application.Run. E.g.

Dim myResult As Variant

myResult = Application.Run("MyFunction", 12.3, 3.4)

There is another story to make use of the new COM Server functionality to expose classes to VBA, but that's a bit more advanced.

-Govert

Jun 28, 2011 at 3:49 AM

Hi Govert,

Thanx a lot, My problem got solved, it's working properly. I can call my Function using 

Dim myResult As Variant

myResult = Application.Run("MyFunction", 12.3, 3.4)

Thanx again,

Regards

Danu123