If FSO is used to process files, can you make it do so in alphabetical order.
If I run this code, normally it does in alphabetical order, but if I amend one of the files, then it changes order. It's as if both alphabvetical order and last saved or last modified is used.
If I run this code, normally it does in alphabetical order, but if I amend one of the files, then it changes order. It's as if both alphabvetical order and last saved or last modified is used.
VBA Code:
Sub Add_files_to_menu(cb As CommandBar, blnBeginGroup As Boolean)
Dim FSO As Object, SourceFolder As Object, FileItem As Object
Dim m As CommandBarPopup
Dim mi As CommandBarButton
Set FSO = CreateObject("Scripting.FileSystemObject")
Set SourceFolder = FSO.GetFolder("C:\Files\")
Set m = cb.Controls.Add(msoControlPopup, , , , True): With m: .BeginGroup = blnBeginGroup: .Caption = "List files": End With
For Each FileItem In SourceFolder.Files
Set mi = m.Controls.Add(msoControlButton, , , , True)
With mi
.Caption = FileItem
End With
Next FileItem
End Sub