Grab the Free VBA Quick Reference Guide
[ Ссылка ]
In this Video we use VBA to Loop through all the Files in a specific Folder Path.
To do this we use a For loop to loop through each file in the folder path and then place the file names on the worksheet
code
===============
Sub AllFiles()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
rw = 10
fle = Range("C6") & "\"
Set objFolder = objFSO.getfolder(fle)
For Each objFile In objFolder.Files
If Right(objFile.Name, 4) = "xlsx" Then
Cells(rw, 3) = objFile.Name
Cells(rw, 4) = objFile.datecreated
Cells(rw, 5) = objFile.parentfolder.Path
rw = rw + 1
End If
Next
End Sub
VBA Loop Through All Files in a Folder
Теги
excel macro loop through all files in a foldervba filesystemobject loop through files in folderexcel vba: loop through all fileexcel vba loop through all files in a folder and opengo through all file in a foldervba go through each file in a folderexcel vba loop through all files in a foldervba loop through filesloop files folder vba excelloop through filesloop through files in vbavba loop through files in folder dirvba files namesloopvbaEverydayvbamacro