Accessing A Control's Properties

J

Jerry Bodoff

Hi,

Environment: WORD2000, XP Home Edition

I wish to access the properties of any control on a User
Form for eventually listing the control and associated
properties. To get and process each control on the form
I have the following Subs:

Private Sub ProcessForm(FormName as Variant)
Dim FormObj as Object
Dim FormCtrl As Object

Set FormObj = UserForms.Add(FormName)

For Each FormCtrl In FormObj.Controls
Call ProcessControl(FormCtrl)
Next

Set FormObj = Nothing
End Sub

Private Sub ProcessControl(ControlObj As Object)
Dim ????
Dim PropertyName as Property

Set ???? = ????

For Each PropertyName in ????
Debug.Print PropertyName.Name & _ | Prop Name?
Space(4) & _
PropertyName.Value | Prop Value?
Next
End Sub

The question is I do not know what to program for the
???'s. I have searched VBA Help, FAQ's, Knowledge Base
and the Web but cannot seem to find anything that would
give me a clue. I know I missed the boat somewheres but
I am not sure what boat.

Any help would be greatly apprciated.

Jerry B.
 
W

Word Heretic

G'day "Jerry Bodoff" <[email protected]>,

Properties don't work like that. You'll have to read the control type
and have huge select cases with manual hard-coding of the control's
properties.


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Jerry Bodoff reckoned:
 
J

Jerry Bodoff

Hi Steve,

Thanks for the reply. Based on what you say I do not
feel so stupid trying to read the properties.

I guess instead of "hard coding" the control properties
in the VBA code I will make a file that I can read in.

By the way, is there an API that you know of that can do
the job?. I have looked at the API's and I think I am
looking for the wrong thing.

Once again, thanks.

Jerry B.
 
J

Jerry Bodoff

Hi Steve,

I actually found code. The URL is:
http://www.vbdesign.net/expresso/showthread.php?
s=&threadid=2189

At least it gives me ideas of how to do it. As I said,
instead of "hard-coding" the property data I will
probably use something like a "Property-INI" file. That
way I could add or delete anything easily. It will
probably make the code module smaller in addition.

Thanks for your help.

Jerry B.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top