北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |
煮江品茶老师的代码
Option Compare Database
Function GetFileList(MyPath As String) As String
'功能说明:按文件夹路径,返回该文件夹下文件字符串列表
'参数:MyPath--父文件夹路径
'示例:GetFldList(CurrentProject.Path)
Dim myFSO As New FileSystemObject
Dim myFolder As Folder
Dim myfile As File
Dim str As String
Set myFolder = myFSO.GetFolder(MyPath)
If myFSO.FolderExists(myFolder) = True Then
str = ""
For Each myfile In myFolder.Files
str = str & myfile.Name & ";" & myfile.DateCreated & ";" & Int(myfile.Size / 1024) & ";" & myfile.Type & ";"
Next myfile
GetFileList = "文件名称;创建时间;文件大小;文件类型;" & str
Else
MsgBox "文件夹不存在"
GetFileList = "文件名称;创建时间;文件大小;文件类型;"
End If
End Function