Hi, all!

I am troubleshooting a macro (for a co-worker) that looks at a folder full of presentations and then copies all of the slides from each of those files into the main presentation file (the one the macro is ran from). The issues is, for whatever reason, the macro has not been properly sorting the files this week.

For example, file name beginning with SB16A_00_XX comes before SB16_00_XX

I've tried incorporating some quicksort routines, but i still sorts files like the above. We're trying to make it sort files like it does in the windows explorer "Name" button.

Any tips are appreciated!

here's the macro code:

Sub InsertAllSlides()
Dim osource As Presentation
Dim otarget As Presentation
Dim oSlide As Slide
Dim bMasterShapes As Boolean
Dim vArray() As String
Dim x As Long
' Insert all slides from all presentations in the same folder as this one
' INTO this one; do not attempt to insert THIS file into itself, though.

Set otarget = ActivePresentation
' Change "*.PPT" to "*.PPTX" or whatever if necessary:
EnumerateFiles ActivePresentation.Path & "\", "*.PPT", vArray

On Error GoTo ErrorHandler

With ActivePresentation
For x = 1 To UBound(vArray)
If Len(vArray(x)) > 0 Then


Set osource = Presentations.Open(vArray(x), , , False)



For Each oSlide In osource.Slides
oSlide.Copy

Next oSlide
osource.Close
Set osource = Nothing


End If
Next
End With

ErrorHandler:
Debug.Print Err.Number, Err.Description

End Sub

Sub EnumerateFiles(ByVal sDirectory As String, _
ByVal sFileSpec As String, _
ByRef vArray As Variant)
' collect all files matching the file spec into vArray, an array of strings

Dim sTemp As String
ReDim vArray(1 To 1)

sTemp = Dir$(sDirectory & sFileSpec)
Do While Len(sTemp) > 0
' NOT the "mother ship" ... current presentation
If sTemp <> ActivePresentation.Name Then
ReDim Preserve vArray(1 To UBound(vArray) + 1)
vArray(UBound(vArray)) = sDirectory & sTemp
End If
sTemp = Dir$
Loop

End Sub