Someone suggested this, but I can't figure out how to get it to work...

VB Code:
  1. If InStr(strData, Chr$(27)) Then
  2.                                 i = InStr(strData, Chr$(27))
  3.                                 While i <> 0
  4.                                     'process
  5.                                     txtGameOutput.SelStart = i + 1
  6.                                     If InStr(i + 1, Text, Chr$(27)) Then
  7.                                         txtGameOutput.SelLength = InStr(i + 1, Chr$(27) - i)
  8.                                     Else
  9.                                         txtGameOutput.SelLength = Len(strData) - i
  10.                                     End If
  11.                                     txtGameOutput.SelColor = Color
  12.                                     etc
  13.                                     txtGameOutput.SelBold = True
  14.                                     etc
  15.                                     txtGameOutput.SelItalic = False
  16.                                     i = InStr(i + 1, strData, Chr$(27))
  17.                                 Wend
  18.                                 txtGameOutput.Text = txtGameOutput.Text & strData
  19.                                 '
  20.                                 txtGameOutput.SelStart = Len(txtGameOutput.Text)

Where process is the stuff to determine the code and replacement...

Any ideas?