0

I want to reference c# code inside VBA. I did this following

  1. Created .dll and .tlb files from visual studio for c# project. I also checked "Register for COM interop" in the project properties.

  2. Now I went to VBA editor in excel Developer tab and then from Tools -> Reference, I added the .tlb file.

Now when I tried to use the c# class by creating an instance, it failed to recognize the class. Error- User Type not defined

Dim obj As Parser.Form1
Set obj = New Parser.Form1

What am I doing wrong here? Please suggest solution. I am a newbee to .NET and VBA

Thanks

Community
  • 1
  • 1
user3613720
  • 47
  • 1
  • 9
  • 3
    Possible duplicate of [Calling a .net library method from vba](http://stackoverflow.com/questions/19954001/calling-a-net-library-method-from-vba) – rory.ap Jul 26 '16 at 17:26
  • Voting to close as a dupe of this question, answered by yours truly: http://stackoverflow.com/questions/19954001/calling-a-net-library-method-from-vba – rory.ap Jul 26 '16 at 17:26

0 Answers0