PixPath is the full path to a folder of jpg’s, and I’m using code like the following to process each jpg.
fileName = Dir(PixPath)
Do Until fileName = ""
If Right$(fileName, 4) = ".jpg" Then
fileName = Dir()
<process this jpg>
End If
Loop
This works fine except the files are returned in alpha-numeric order, and not the order that the files are shown listed in the folder. Is there any way around this?
You can’t do this with
Dir.An alternative is to:
FileSystemObjectto access all the files in your directory.jpgfiles into an array XValto compare the.jpgs by value to sort in a numeric ascending orderThe final array X contains the sorted files
See here for more info on using
FileSystemObject.