dim buf as string buf=dir("i:\*.*") do whilr buf<>"" if buf<>"." and buf<>".." then debug.print buf end if buf=dir loop
Private Sub Command1_Click() Dim i As String i = Dir(App.Path & "\*.*", vbReadOnly) Do While i <> "" MsgBox i i = Dir Loop End Sub
'调用Project-->References-->Microsoft Scripting Runtime Dim fso As New FileSystemObject Dim fi, fc, f Set f = fso.GetFolder(你的文件名) '得到临时文件夹全部文件 Set fc = f.Files '文件夹不存在,退出 If Not fso.FolderExists(你的文件名) Then Exit Sub For Each f1 In fc '编历 debug.print f1.name Next
buf=dir("i:\*.*")
do whilr buf<>""
if buf<>"." and buf<>".." then
debug.print buf
end if
buf=dir
loop
Dim i As String
i = Dir(App.Path & "\*.*", vbReadOnly)
Do While i <> ""
MsgBox i
i = Dir
Loop
End Sub
Dim fso As New FileSystemObject
Dim fi, fc, f
Set f = fso.GetFolder(你的文件名)
'得到临时文件夹全部文件 Set fc = f.Files '文件夹不存在,退出
If Not fso.FolderExists(你的文件名) Then Exit Sub For Each f1 In fc '编历
debug.print f1.name
Next