Sub ShowFolderList1(folderspec1)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec1)
Set fc = f.Files
For Each f1 In fc
s = f1.Name
Me.List1.AddItem (s)
Me.List1.Requery
Next
End Sub
Sub ShowFolderList1(folderspec1)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject") '将文件系统对象赋值给fs
Set f = fs.GetFolder(folderspec1) '将文件夹对象赋值给f
Set fc = f.Files '将文件组对象赋值给fc
For Each f1 In fc '将f文件夹下的文件名循环添加至列表框中
s = f1.Name '获取文件名
Me.List1.AddItem (s) '添加文件名
Me.List1.Requery '重算并刷新列表框
Next
End Sub