Sub Get_All_Files_in_Dir()I = 11
Dim myFso As Scripting.FileSystemObject
Dim myFiles As Scripting.Files
Dim myFile As Scripting.File
Set myFso = New Scripting.FileSystemObject
'SET THE FILES NAMEcells(i,1)= myFile.Name
Set myFiles = myFso.GetFolder(ThisWorkbook.Path).Files
For Each myFile In myFiles
I = I + 1
Next
Set myFiles = Nothing 'release all
Set myFso = Nothing
End Sub
註 : 要開用 Microsoft Scripting Runtime
沒有留言:
張貼留言