VB Code:
Private Sub cmdDecode_Click()
Dim myCode As String
Dim CodeChar As String
Dim intCount As Integer
Dim Needle As String
Dim intLetterNum As Integer
myCode = txtCode.Text
intLetterNum = Asc("Z")
For intCount = 26 To 1 Step -1
CodeChar = Chr$(intLetterNum) 'This is what the "code" will be (letters Z through A)
Needle = CStr(intCount) & "-" 'Needle is the item being looked for... a number followed by a dash.
myCode = Replace(myCode, Needle, CodeChar) 'In MyCode, replace all ocurrances of Needle with CodeChar
Needle = CStr(intCount) & " " ' Not all numbers were followed by a dash, some had a space.
myCode = Replace(myCode, Needle, CodeChar & " ")
Needle = CStr(intCount) & "." 'While others were followed by a period
myCode = Replace(myCode, Needle, CodeChar & ".")
intLetterNum = intLetterNum - 1 'Back up one letter; Z, y, X.... C, B, A
Next
txtText.Text = myCode
End Sub