Friday, November 18, 2005
  
Sub BubbleSort(pstrArray() As String, plngMaxItem As Long)
Dim i As Long
Dim fSwitched As Boolean
Dim strTemp As String

Do
fSwitched = False
For i = 1 To plngMaxItem - 1
If pstrArray(i) > pstrArray(i + 1) Then
' item out of place, move it
fSwitched = True
' swap items
strTemp = pstrArray(i)
pstrArray(i) = pstrArray(i + 1)
pstrArray(i + 1) = strTemp
End If
Next
Loop While fSwitched
End Sub