Solved

How to get the Properties of any Object at Runtime?

Posted on 1998-12-22
9
187 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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
 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
consolidate or create a new vba code for performing tasks 5 66
VB6 Compile Compatibility Issue 4 102
fso.FolderExists("\\server\HiddenFolder$") 4 65
Excel Automation VBA 19 70
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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

770 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