View Single Post
 
Old 08-22-2013, 11:03 PM
fumei fumei is offline Windows 7 64bit Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

You do not state what you want to do with this list. Write to another document perhaps. In any case this may help you get started.
Code:
Sub ListCaptions()
Dim oCtl As MSForms.Control
For Each oCtl In UserForm1.Controls
   If TypeOf oCtl Is MSForms.CheckBox Or _
      TypeOf oCtl Is MSForms.Label Or _
      TypeOf oCtl Is MSForms.OptionButton Then
      MsgBox oCtl.Name & vbTab & oCtl.Caption
   End If
Next
End Sub
This gets the values for the controls that DO have Captions. For example textboxes, comboboxes do NOT have Captions. Thus they are not included in the test.
Reply With Quote