是否可以在 VBA 中定义结构或对象数组?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11012844/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to define an array of structures or objects in VBA?
提问by ACEG
I have to implement something in an Excel macro (yuk!), for which I would like to use an array of structures or objects. (Is this even possible at all in Excel VBA?)
我必须在 Excel 宏中实现一些东西(yuk!),我想使用结构或对象数组。(这在 Excel VBA 中甚至可能吗?)
The problem is, I can only find extremely meager documentation. Can someone please provide some pointers to good VBA documentation, or a suggestion about using VBA structures?
问题是,我只能找到极其贫乏的文档。有人可以提供一些指向良好 VBA 文档的指针,或有关使用 VBA 结构的建议吗?
回答by mattboy
Perhaps a Type structure is what you're looking for?
也许 Type 结构是你要找的?
http://www.cpearson.com/excel/classes.aspx(scroll down a little)
http://www.cpearson.com/excel/classes.aspx(向下滚动一点)
Then I suppose you would use this in combination with VBA arrays.
然后我想您会将它与 VBA 数组结合使用。
http://www.cpearson.com/excel/vbaarrays.htm
http://www.cpearson.com/excel/vbaarrays.htm
Hope that helps a little.
希望能有所帮助。