Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list of all properties for an object

Tags:

excel

vba

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:

list = object.enumproperties

Any ideas?

like image 346
user2021539 Avatar asked Nov 05 '13 06:11

user2021539


People also ask

How can you get list of all properties in an object?

getOwnPropertyNames() The Object. getOwnPropertyNames() method returns an array of all properties (including non-enumerable properties except for those which use Symbol) found directly in a given object.

How do I see all the attributes of an object in python?

Use Python's vars() to Print an Object's Attributes The dir() function, as shown above, prints all of the attributes of a Python object.

How do I see all attributes of an object in PowerShell?

To get the object properties, the Get-member cmdlet is used in PowerShell. Specify a cmdlet, use the pipeline operator, and then type the Get-Member cmdlet to see all of the properties available from the specified command.


1 Answers

Tools - References - 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
like image 147
GSerg Avatar answered Oct 04 '22 13:10

GSerg