This question is an extension of a previous question: Return an object in VBA
Now, I'd like to know how to declare and initialize the object in VBA. It seems like I'd do it like so:
Declare Function ConnectMe Lib "C:\Windows\System32\cm.dll" (ByVal Arg1 As String) As ConnectMe
Declare Function login Lib "C:\Windows\System32\cm.dll" (ByVal Arg1 As String, ByVal Arg2 As String) As Boolean
Then, below this line, I could use this code:
dim cm as new ConnectMe
cm.ConnectMe("216.239.51.99")
cm.login("username","password")
However, when I do this, it gives me a "User-defined type not defined" error. How can I declare this C++ class appropriately so that I can create and use an instance in VBA?
Thanks.