'Hi,
Wow! Finally a question I might be able to answer. I've benifitted unbelieveably from this forum and would like to take this opportunity to share with you some of the insights I've gained.
I like to have some control over what I'm doing. I'll walk you through how I do it.
I don't know how much you know, all I can say is "I've got a lot learning to do" so I'll dumb it down as much as possible.
1. I determine the extension I'm looking for, you don't have to.
2. I pass all the files of that extension to an array. This is also great for a quick inspection to verify I'm getting all the files. Frankly, I always have.
3. Using that array, I loop through all the files in the array.
So, here we go...
Public Sub FillArray_FilesFromFolder(arr() As String, sFldr As String, sExtension As String)
Dim c As Integer
Dim s As String
sExtension = "*." & sExtension
s = Dir(sFldr & sExtension)
c = 0
Do While s <> ""
ReDim Preserve arr(c)
arr(c) = s
s = Dir
c = c + 1
Loop
End Sub
'------------------
'What I do is call that function:
'1. You have to be in a procedure.
'2. You need to have an array already delcared.
dim arr_of_File_Names_to_Process() as string. ' note: you need to have the brackedts after the name in order for it to be an array.
Call(arr_of_File_Names_to_Process, The_Folder_Name, The_Extension_of_the_Files)
'Now we have a an array full of the file names
Dim l as Long
For l = LBound(arr_of_File_Names_to_Process) to UBound(arr_of_File_Names_to_Process)
'put what you want to do in here as this loop will
'cycle through each of the file names for you.
Next
Please excuse any typo's, as I just got sick.
Best of luck.