LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Userform listing

Hi Nick
Got it! I will have to adjust the code to use outside the userform in
question but it works ok now
Cheers
Nigel

"NickHK" wrote:

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






 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listing Application Userform Contents Nigel RS[_2_] Excel Programming 2 October 12th 06 07:32 AM
Listing all userform controls Nigel RS[_2_] Excel Programming 0 October 10th 06 02:13 PM
DSN Listing Michael Rekas[_2_] Excel Programming 6 February 26th 05 12:41 PM
sum and listing Andreas5516 Excel Discussion (Misc queries) 2 February 4th 05 10:44 PM
Listing of one cell controlling the listing of another cell. peijuan Excel Programming 0 August 8th 04 03:17 AM


All times are GMT +1. The time now is 03:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"