Solved

How to get the Properties of any Object at Runtime?

Posted on 1998-12-22
9
184 Views
Last Modified: 2010-05-03
I would like to know how to get a list of exposed public properties of a given object at runtime and probably have a list of them in any form, as a collection or as an array...any thing.
0
Comment
Question by:teluguvadu
9 Comments
 

Author Comment

by:teluguvadu
ID: 1452063
This is urgent
0
 
LVL 1

Expert Comment

by:khaledc
ID: 1452064
Well you can not have an array of all the properties of an object. All what you can do is save the properties of a certain object one by one to User Defined Type variable or declare a variable as the object.
eg:
Dim MyObject as Form 'MyObject will be a Form Type variable
then you can assign this variable to your form
MyObject=form1   'THis will save all the needed property of form1 in MyObject
I hope that answer your quesiton
0
 
LVL 2

Expert Comment

by:PedroG
ID: 1452065
that way you will not know the properties of an unknown automatation object, and in order to do that you must go deep into COM
0
 

Expert Comment

by:stingray
ID: 1452066
Have what you need.  Just found it in the last two days.  Send me your e-mail address and I will send the info to you.  (Have to find out where I saved it in the mean time).

stingray@canada.com
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:teluguvadu
ID: 1452067
Yes, What Khaledc has proposed does'nt help. I guess PedroG has some suggestions and it looks likes stingray too is thinking in the same lines.
0
 
LVL 3

Expert Comment

by:vmano
ID: 1452068
stingray,
can you please post your code so that all (other) experts can take a look at it???

thanks
vmano
0
 

Author Comment

by:teluguvadu
ID: 1452069
The code stingray suggested does'nt help me. I am sorry if it has dampened the urgency.

Thanks
Teluguvadu
0
 
LVL 2

Expert Comment

by:PedroG
ID: 1452070
Teluguvado, you must serch to find how to query the object for its interface, i know it has something to do with the implementation of the IUknown interface.

I'm sory i can't help you right now cos i'm with no free time, i will check this in a few days if still now answer i will search to try and find one
0
 
LVL 1

Accepted Solution

by:
wdavidsmith earned 120 total points
ID: 1452071
If the properties are "public" they should be accessible...

Sub ListProperties(objWhatever As Object)

   Dim prpTemp As Property
   
   ' Loop through the object's properties collection
   For Each prpTemp In objWhatever.Properties
      Debug.Print "Property Name: " & prpTemp.Name
      Debug.Print "Property Value: " & prpTemp.Value
      Debug.Print ""
   Next prpTemp

End Sub

This is the case with database objects (DAO) and should be true for any object that has a properties collection.

I hope this helps...
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now