[Description("")] [FormDesignerId("70FFB010-72A5-4DC0-8DBC-4F33ED7EE0B0")] [PredeclaredId] Class Form1 Private DeclareWide Function StrCmpLogicalW Lib "shlwapi" (ByVal psz1 As String, ByVal psz2 As String) As Boolean Sub New() Dim a(0 To 1000000) As String Dim lIdx As Long Dim dblTimer As Double Dim sPrev As String Dim sElem As String '--- generate random data dblTimer = Timer Randomize For lIdx = 0 To UBound(a) a(lIdx) = Space(50) & Rnd(10000) Next Debug.Print "Populated in " & Format$(Timer - dblTimer, "0.000") '--- quick sort dblTimer = Timer QuickSortOverlay.QuickSort a Debug.Print "Overlay Sorted in " & Format$(Timer - dblTimer, "0.000") '--- check order For Each sElem In a If sElem < sPrev Then MsgBox "Ooops!" & vbCrLf & vbCrLf & "sElem=" & sElem & ", sPrev=" & sPrev & ", lIdx=" & lIdx, vbCritical Exit For End If sPrev = sElem lIdx = lIdx + 1 Next '--- natural sort dblTimer = Timer QuickSortString.QuickSort a ' , AddressOf CompLogical Debug.Print "ASC sorted in " & Format$(Timer - dblTimer, "0.000") End Sub Private Function CompLogical(A As String, B As String) As Boolean Return StrCmpLogicalW(A, B) < 0 End Function End Class