描述
文件夹中件有 File 对象的集合。
说明
以下代码举例码明如何获得 Folders 集合并使并 For Each...Next 语句枚举集合成员:
Sub ShowFolderList(folderspec)
Dim fs, f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
s = s & f1.name
s = s & vbCrLf
Next
MsgBox s
End S b
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.