I am attempting to create a DLL in VB.NET using Visual Studio 2017. The DLL will be used in VBA in another application. The VB.NET project is a .NET Framework Class Library project.
I've added the *.TLB file as a reference in VBA. I'm only trying to create and use one method in the class library. I'm calling it in VBA using something similar to the following:
Sub MySub()
Dim TestObj As MyProjectName.MyClassName
Set TestObj = New MyProjectName.MyClassName
Call TestObj.MyMethodName(Argument)
End Sub
The code always throws Runtime Error 429 "ActiveX component can't create object" on the following line (from the example above):
Set TestObj = New MyProjectName.MyClassName
This question has been asked before, however most of them are quite old (~10 years) and none of the solutions offered made any difference. I keep finding references to REGASM.EXE. It is my understanding that Visual Studio handles this automatically and that calling this manually isn't necessary when the "Project>Properties>Compile>Register for COM interop" checkbox is checked.
I have followed these instructions to the letter: https://smallbusiness.chron.com/use-net-class-library-excel-vba-40349.html
In addition I tried creating a COM class instead per the answer to the following question: ActiveX component can't create object when using .net class in vba
I've tried at least half a dozen different iterations of this and they all give Runtime Error 429 "ActiveX component can't create object". Is there something I'm missing here? Could it be a version issue somehow? My VS project is targeting .NET Framework 4.7.2.