返回VBA中的对象 [英] Return an object in VBA
问题描述
我建立了一个自定义DLL,对于这个例子,有一个函数 login
。在C ++中,我使用它通过创建一个对象,然后通过对象指针访问该函数,如下:
ConnectMe * cm =新ConnectMe(216.239.51.99);
cm-> login(username,password)
d喜欢能够做的是在Excel中使用这个代码。我创建了一个DLL并导出了相应的函数。我如何在VBA中这样做? VBA支持返回指针到我自己的自定义对象吗?此页面(http://msdn.microsoft.com/en- us / library / sect4ck6.aspx)未能指定可从函数返回的类型。
提前感谢。
如果你的DLL是在机器中注册的,在工具/引用中, ,在您的代码中使用
dim cm as new ConnectMe
cm.ConnectMe(216.239.51.99 )
cm.login(username,password)
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 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")
这篇关于返回VBA中的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!