1

I have written class library in c# like this (simplified):

namespace DotNetLibrary
{
    public class CPoint
    {
        public int x;
        public int y;

        public CPoint(int x, int y)
        {
            this.x = x;
            this.y = y;
        }

        public List<CPoint> GetSomePoints()
        {
            List<CPoint> result = new List<CPoint>();

            for (int i = 0; i < 100; i++)
            {
                for (int j = 0; j < 100; j++)
                {
                    result.Add(new CPoint(i, j));
                }
            }

            return result;
        }
    }
}

In Excel in VBA can create instance of class CPoint like this:

Private Sub TestDotNetCall()
Dim pt As New CPoint
End Sub

How can I call method 'GetSomePoints'? And how can I access to the items of the List in VBA?

user1885304
  • 55
  • 2
  • 6
  • Check out this link: http://stackoverflow.com/questions/1170794/a-simple-c-sharp-dll-how-do-i-call-it-from-excel-access-vba-vb6 – Ripster Dec 18 '13 at 14:20
  • Im affraid thats not going to help me - the method HelloWorld returns string and I need to work with list of objects :( – user1885304 Dec 18 '13 at 14:48
  • 1
    Check this link: [Access VBA equivalent to a C# List](http://stackoverflow.com/questions/3497982/access-vba-equivalent-to-a-c-sharp-listt) - VBA doesn't support List generic class, it is possible to use Collection ;) – Maciej Los Dec 30 '13 at 12:16

0 Answers0