基本思路是! dir控件 + file控件 dir 控件指定目标文件夹 >> file控件显示目标文件夹里的内容 !循环 file控件的项目 就是你想要的了!for i = 0 to file.listcount-1open... ... close #若想打开的全部是txt 或其他类型的文件 可以设置file控件 让其只显示自己需要类型的文件 便可以了!
dim s as string dim sFullPath as string s = dir("c:\test\*.txt") while lenb(s) <> 0 if (s<>".") and (s <> "..") then sFullPath = "c:\test\" & s if (getattr(sfullpath) and vbdirectory) <> vbdirectory then '读取文件 sFullPath ... end if end if s = dir() wend
...
close #若想打开的全部是txt 或其他类型的文件 可以设置file控件 让其只显示自己需要类型的文件 便可以了!
dim sFullPath as string s = dir("c:\test\*.txt")
while lenb(s) <> 0
if (s<>".") and (s <> "..") then
sFullPath = "c:\test\" & s
if (getattr(sfullpath) and vbdirectory) <> vbdirectory then
'读取文件 sFullPath
...
end if
end if
s = dir()
wend