vba 获取对象的所有属性列表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19783180/
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
Get list of all properties for an object
提问by user2021539
Is there a way to get a list of all valid properties for a given object?
有没有办法获取给定对象的所有有效属性的列表?
If I wanted to start at cell a1, and go down and assign a1, a2, a3, all of the valid properties for let's say a worksheet object for example, is that something that can be done? I can't find any:
如果我想从单元格 a1 开始,然后向下分配 a1、a2、a3,例如工作表对象的所有有效属性,这是可以完成的吗?我找不到任何:
list = object.enumproperties
Any ideas?
有任何想法吗?
回答by GSerg
Tools - References - TypeLib Information
.
工具-参考- TypeLib Information
。
Then:
然后:
Sub DumpProperties(ByVal o As Object)
Dim t As TLI.TLIApplication
Set t = New TLI.TLIApplication
Dim ti As TLI.TypeInfo
Set ti = t.InterfaceInfoFromObject(o)
Dim mi As TLI.MemberInfo, i As Long
For Each mi In ti.Members
i = i + 1
ActiveSheet.Cells(i, 1).Value = mi.Name
Next
End Sub