Private Sub UserForm_Initialize()
Dim wkb As Workbook
Dim wks As Worksheet
Dim ndeMain As Node, ndeSecond As Node
Dim iCounter As Integer
With TreeView1
For Each wkb In Workbooks
iCounter = iCounter + 1
Set ndeMain = .Nodes.Add(Text:=wkb.Name)
For Each wks In wkb.Worksheets
Set ndeSecond = .Nodes.Add(relative:=ndeMain, _
relationship:=tvwChild, _
Text:=wks.Name)
ndeSecond.Sorted = True
Next wks
Next wkb
ndeMain.Expanded = True
ndeMain.Sorted = True
End With
End Sub