获取对象的所有属性列表 [英] Get list of all properties for an object
本文介绍了获取对象的所有属性列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法获取给定对象的所有有效属性的列表?
Is there a way to get a list of all valid properties for a given object?
如果我想从单元格a1开始,然后分配a1 ,a2,a3,所有有效的属性,例如说一个工作表对象,是可以做的事情吗?我找不到:
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:
list = object.enumproperties
list = object.enumproperties
任何想法?
推荐答案
工具 - 参考 - TypeLib信息
。
Tools - References - TypeLib Information
.
然后:
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
这篇关于获取对象的所有属性列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文