Hi All
I have a code that loads files from a specific directory. All files at named based on a simple dateformat i.e 01012018 or 19122018.
My issues is that when the files are loaded into the listbox, they are not sortet. Sorting the folder does not solve my problem. All i really want is for the newest file to be on top and so forth.
Please help
Code for loading looks like this and works
I have a code that loads files from a specific directory. All files at named based on a simple dateformat i.e 01012018 or 19122018.
My issues is that when the files are loaded into the listbox, they are not sortet. Sorting the folder does not solve my problem. All i really want is for the newest file to be on top and so forth.
Please help
Code for loading looks like this and works
Code:
Private Sub UserForm_Initialize()
fpath = ThisWorkbook.path & "\Input\"
ListBox1.Clear
orderfile = Dir(fpath & "*.xls*", vbNormal)
Do While Len(orderfile) > 0
ListBox1.AddItem orderfile
orderfile = Dir()
Loop
End Sub