VB Code:
Public Sub PrintName(ByVal cont As Control)
Dim xl As New Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
For Each ctl As Control In cont.Controls
Application.DoEvents()
wb = xl.Workbooks.Open("C:\Documents and Settings\arichardson\Desktop\controlNames.xls")
ws = wb.Worksheets.Item(1)
ws.Cells(1, 1).Value = ctl.Name
ws.Cells(2, 1).Value = ctl.Parent.Name
wb.Save()
wb.Close()
Try
If TypeOf ctl Is TabControl Then
PrintName(ctl)
End If
If TypeOf ctl Is TabPage Then
PrintName(ctl)
End If
If TypeOf ctl Is GroupBox Then
PrintName(ctl)
End If
Catch
End Try
Next
End Sub