colezpapa3
Programmer
I am loading the contents of a folder and its subfolders into a combo box. I am displaying the sub-folder, then the contents. It looks like this..
\x1
--------
file1.txt
file2.txt
\xtest
--------
file5.txt
file7.txt
Can I sort the combo box in such a way that the folders are sorted in order. The code is as follows...
Set objFSO = New FileSystemObject
Set objFld = objFSO.GetFolder(strFolder)
For Each objFolder In ThisFolderSubs
x = StrReverse(objFolder)
y = InStr(x, "\")
z = Mid$(x, 1, y)
z = StrReverse(z)
Me.ctlList.AddItem " "
Me.ctlList.AddItem z
Me.ctlList.AddItem "------------------ "
For Each objFile In objFolder.Files
Me.ctlList.AddItem objFile.Name
Next
'
\x1
--------
file1.txt
file2.txt
\xtest
--------
file5.txt
file7.txt
Can I sort the combo box in such a way that the folders are sorted in order. The code is as follows...
Set objFSO = New FileSystemObject
Set objFld = objFSO.GetFolder(strFolder)
For Each objFolder In ThisFolderSubs
x = StrReverse(objFolder)
y = InStr(x, "\")
z = Mid$(x, 1, y)
z = StrReverse(z)
Me.ctlList.AddItem " "
Me.ctlList.AddItem z
Me.ctlList.AddItem "------------------ "
For Each objFile In objFolder.Files
Me.ctlList.AddItem objFile.Name
Next
'