开发者

Return an object in VBA

开发者 https://www.devze.com 2023-04-10 16:07 出处:网络
I\'ve built a custom DLL which, for this example, has a function login. In C++ I use it by creating an object and then accessing the function through the object pointer, like so:

I've built a custom DLL which, for this example, has a function login. In C++ I use it by creating an object and then accessing the function through the object pointer, like so:

ConnectMe *cm = new ConnectMe("216.239.51.99");
cm->login("username", "password")

What I'd like to be able to do is use this code in Excel. I've created a DLL and have开发者_如何学Python exported the appropriate functions. How can I do this in VBA? Does VBA support returning pointers to my own custom objects? This page (http://msdn.microsoft.com/en-us/library/sect4ck6.aspx) fails to specify what kinds of types can be returned from a function.

Thanks in advance.


If your DLL is registered in machine, in tools/reference, set the check to.

After, in your code use

dim cm as new ConnectMe

cm.ConnectMe("216.239.51.99")

cm.login("username","password")
0

精彩评论

暂无评论...
验证码 换一张
取 消