So this is my first post in this great community and I'm an absolute beginner, I'm sure I'll get good advice from here.
I mad this simple VB class library in Visual Studio 2017
Public Class Addition
Public Function Add(No1 As Long, No2 As Long) As Long
Return No1 + No2
End Function
End Class
I made it COM visible and checked Register for COM interop. and build the project.
In my access VBA project, I've added the reference to my Dll without a problem and put the following code behind the click event of a button.
Private Sub Command0_Click()
Dim myCalc As ShwDolphin.Addition
Set myCalc = New ShwDolphin.Addition
Dim Num As Long
Num = myCalc.Add(2, 5)
Debug.Print Num
End Sub
"ShwDolphin" is VB assembly name.
But I always get this error message "Runtime error 429 Active X component can't create an object"
Can you please tell me what I'm doing wrong here? This is driving me crazy.
Thank you very much.
C:\Windows\SysWOW64directory and in VBA editor add reference to tlb from this directory. Don't forget to check the checkbox in VBA references dialog.ShwDolphininReferencesdialog of VBA editor? Or do you see checkbox checked beside this name already? It is two step process inside of the referenecens dialog. Firs add, then select.