Sub ShowFolderInfo() Dim folderspec$ Dim filename$ folderspec = "E:huoqutest" 'Debug.Print folderspec Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFolder(folderspec) 's = f.DateCreated 'MsgBox s 'p = f.Path 'MsgBox p 'n = f.Name 'MsgBox n
For Each ff In f.SubFolders m = m + 1 Cells(m, 1) = ff.Name filepath = "E:huoqutest" & ff.Name & "" Debug.Print filepath filename = Dir(filepath) Debug.Print filename Do While filename <> ""
ss = ss & filename ss = ss & vbCrLf filename = Dir Debug.Print filename Loop n = n + 1 Cells(n, 4) = ss ss = ""
Dim folderspec$
Dim filename$
folderspec = "E:huoqutest"
'Debug.Print folderspec
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
's = f.DateCreated
'MsgBox s
'p = f.Path
'MsgBox p
'n = f.Name
'MsgBox n
For Each ff In f.SubFolders
m = m + 1
Cells(m, 1) = ff.Name
filepath = "E:huoqutest" & ff.Name & ""
Debug.Print filepath
filename = Dir(filepath)
Debug.Print filename
Do While filename <> ""
ss = ss & filename
ss = ss & vbCrLf
filename = Dir
Debug.Print filename
Loop
n = n + 1
Cells(n, 4) = ss
ss = ""
Next
End Sub
一周热门 更多>