Userform listing
Nigel,
This works for me:
Dim obj As Control
For Each obj In Me.Controls
Debug.Print obj.Name, obj.Caption
Next
You should add error handling and/or test that the control is a type that
has a .Caption first
NickHK
"Nigel RS" wrote in message
...
Hi Nick
I am actaully creating soem documentation and at the same time creating a
list of ALL controls and their captions, particularly Command Buttons and
Labels, as these will be then subject to changing dynamically through an
lok
up process.
Ther first task was to get the list of all controls on all forms (a total
of
over 500). Which I did not wnat to do manually!
I have utilised the controls collection and the userfroms collection
(after
loading all forms). But do not seem to be able to get the captions?
Cheers
"NickHK" wrote:
Having reread your question, you get the userform to list its own
details
using its .Controls collection:
Dim obj As Object
For Each obj In Me.Controls
Debug.Print obj.Name, TypeName(obj)
Next
The userform obviously has to be loaded for this to work.
NickHK
"Nigel RS" wrote in message
...
Anyone have code or know of a utility to list all userforms and
controls
types and captions on a worksheet?
Thanks
|