Hi, I need to save down 200+ files from data in a worksheet. I want to modify the below so instead of moving files based on a list in a worksheet it creates and saves down the files. So starting with column A until the last column with data I want to copy the information in rows 2 and 3 into a text file and then save it with unique file name which is in B1 and loop until the last column. The file will be saved down with extension .pri which is included in cell b1, and in row 1 thereafter. Any thoughts or is there a better way?
Sub ListFilesDir()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder("S:\")
i = 1
'loops through each file in the directory and prints their names and path
For Each objFile In objFolder.Files
'print file name
Cells(i + 1, 1) = objFile.Name
'print file path
Cells(i + 1, 2) = objFile.Path
i = i + 1
'Cells(i + 1, 3) = objFile.DateLastModified
'i = i + 1
Next objFile
End Sub
Bookmarks