[求助]怎样从一个文件夹提取文件名到表中? Post By:2016/3/10 9:02:00 [显示全部帖子]
怎样从一个文件夹提取文件名到表中?
下面的我从网上找的,不知怎么修改?
Sub 文件名列表() MyPath = "X:\某一文件夹\" ' 指定具体的文件夹 MyName = Dir(MyPath, vbDirectory) Do While MyName <> "" If MyName <> "." And MyName <> ".." Then If (GetAttr(MyPath & MyName) And vbDirectory) <> vbDirectory Then i = i + 1 Cells(i, 1) = MyName End If End If MyName = Dir Loop End Sub