Try writing a function (let's call it SortedString) that splits the string
into the individual characters, sorts the characters alphabetically, then
concatenates them back into a string. Then you can check if
SortedString(string1) = SortedString(string2)
The following untested air-code should get you going:
Function SortedString(StringIn As String) As String
Dim lngLength As String
Dim lngLoop As String
Dim lngLoop1 As String
Dim strInput() As String
lngLength = Len(StringIn)
Redim strInput(1 to lngLength)
For lngLoop = 1 to lngLength
strInput(lngLoop) = Mid$(StringIn, lngLoop, 1)
Next lngLoop
Call QuickSort(strInput, 1, lngLength)
for lngLoop = 1 to lngLength
SortedString = SortedString & strInput(lngLoop)
Next lngLoop
End Function
Public Sub QuickSort(iArray As Variant, l As Long, r As Long)
'iArray() The iArray to sort
'l First element of iArray to start sort
'r Last element of iArray to start sort
Dim X As Long
Dim Y As Long
Dim i As Long
Dim j As Long
i = l
j = r
X = iArray((l + r) / 2)
While (i <= j)
While (iArray(i) < X And i < r)
i = i + 1
Wend
While (X < iArray(j) And j > l)
j = j - 1
Wend
If (i <= j) Then
Y = iArray(i)
iArray(i) = iArray(j)
iArray(j) = Y
i = i + 1
j = j - 1
End If
Wend
If (l < j) Then QuickSort iArray, l, j
If (i < r) Then QuickSort iArray, i, r
End Sub
I just stole the QuickSort routine from Randy Birch
http://www.mvps.org/vbnet/code/sort/qscompare.htm You can substitute your
own favourite sort instead.