Private Sub Command1_Click()
Dim fso As New Scripting.FileSystemObject
Dim sFolder As Scripting.Folder
Dim sFolder_1 As Scripting.Folder
Dim FileName As String, myName As String
'显示文件夹
Set sFolder = fso.GetFolder("C:\")
For Each sFolder_1 In sFolder.SubFolders
TreeView1.Nodes.Add.Text = sFolder_1.path
Next
'显示文件
FileName = "C:\*.*"
myName = Dir(FileName)
Do While myName <> ""
TreeView1.Nodes.Add.Text = myName
myName = Dir
Loop
End Sub