View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default VBA code to list names of controls on user form?

Hi Pete,

Try something like:

'=============
Public Sub Tester()
Dim CTRL
Dim i As Long

For Each CTRL In UserForm1.Controls
i = i + 1
Cells(i, 1).Value = CTRL.Name
Next CTRL

End Sub
'<<=============


---
Regards,
Norman


"Peter" wrote in message
oups.com...
Hi guys,

Can anyone suggest how I could write some code that would return all
the control names on a user form?

I've designed the form and re-named all the controls to something
meaningful. I know that when I right click the form to get a tab order
it displays all the field names so what I really want is a similar
thing that I can output for reference when writing the code.

Thanks in advance

Pete