我刚刚发现here http://analystcave.com/excel-vba-dictionary-arrays-and-other-data-structures/#The_VBA_Queue“内置”Stacks
and Queues
可从 VBA 获取。按照它的写法,我看不到它的属性和方法Queue
目的。
Dim queue As Object
Set queue = CreateObject("System.Collections.Queue") 'Create the Queue
queue.Enqueue "Hello" 'VBE does not show the available properties and methods
所以我的问题是:是否有一个我可以使用的参考,可以让我进行早期绑定并从 VBE 自动完成中受益?就像是:
Dim queue As System.Collections.Queue 'not working
The Stack
and Queue
是来自 .Net 框架的 COM 对象,它们不能用于早期绑定。 (正如@Florent B. 在评论中提到的)。
但是,如果您需要查看 COM 对象的属性,您可以随时查看 MSDN 站点(那里非常明确):https://msdn.microsoft.com/en-us/library/system.collections.queue(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/system.collections.queue(v=vs.110).aspx
或者打开 Visual Studio 并从那里检查 IntelliSense。几乎所有写在那里的东西都有效:
Public Sub TestMe()
Dim myArr As Variant
With CreateObject("System.Collections.Queue")
.Clear
.Enqueue (1)
.Enqueue (2)
myArr = .toArray
End With
Debug.Print myArr(1)
End Sub
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)