This has been driving me batty for a few days.
I am trying to perform a simple task and loop through a folder to retrieve file names.
The problem is I only get 199 files and there are over 400 in the folder.
Here is my latest code:
What am I missing that will let me retrieve ALL the file names regardless of how many files are in the folder?
Thanks,
Craig
I am trying to perform a simple task and loop through a folder to retrieve file names.
The problem is I only get 199 files and there are over 400 in the folder.
Here is my latest code:
Code:
Sub File_Import()
Dim FSO As FileSystemObject
Dim sFolderPath As String
Dim files_collection, filecount, filename, folder, i, file
Set FSO = CreateObject("Scripting.FileSystemObject")
sFolderPath = CurrentProject.path & "\"
Set folder = FSO.GetFolder(sFolderPath)
' get a collection of all the files in the folder
Set files_collection = folder.Files
For Each file In files_collection
filename = file.Name
Debug.Print filename
Next
Set FSO = Nothing
Set folder = Nothing
Set files_collection = Nothing
End Sub
What am I missing that will let me retrieve ALL the file names regardless of how many files are in the folder?
Thanks,
Craig