|
- Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
- Me.TextBox1.Text = TreeView1.SelectedItem.FullPath
- End Sub
- Private Sub UserForm_Initialize()
- Dim d As New Dictionary
- Dim nodex As Node
- Dim r%, i%
- Dim arr
- Dim obj As Object
- On Error Resume Next
- With Worksheets("sheet2")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a2:a" & r)
- End With
- For i = 1 To UBound(arr)
- ss = Mid(arr(i, 1), 2)
- If InStr(ss, "/") <> 0 Then
- brr = Split(ss, "/")
- For j = 0 To UBound(brr)
- If j = 0 Then
- TreeView1.Nodes.Add Key:=brr(j), Text:=brr(j)
- Else
- TreeView1.Nodes.Add relative:=brr(j - 1), relationship:=tvwChild, Key:=brr(j), Text:=brr(j)
- End If
- Next
- End If
- Next
- End Sub
复制代码 |
|