Here you go

VB Code:
  1. Private Sub Command1_Click()
  2.     Dim lngCount As Long
  3.     Dim lngLineIndex As Long
  4.     Dim lngLength As Long
  5.     Dim lngTotLength As Long
  6.     Dim strBuffer As String
  7.     Dim strRichText As String
  8.     Dim i As Integer
  9.     Dim intPos As Integer
  10.     Const WORD_TO_BE_FOUND = "you"
  11.    
  12.     'Get Line count
  13.     lngCount = SendMessage(RichTextBox1.hwnd, EM_GETLINECOUNT, 0, 0)
  14.     With RichTextBox1
  15.         For i = 0 To lngCount - 1
  16.             'Get line index
  17.             lngLineIndex = SendMessage(.hwnd, EM_LINEINDEX, i, 0)
  18.             'get line length
  19.             lngLength = SendMessage(.hwnd, EM_LINELENGTH, lngLineIndex, 0)
  20.             'resize buffer
  21.             strBuffer = Space(lngLength)
  22.             'get line text
  23.             Call SendMessageStr(.hwnd, EM_GETLINE, i, ByVal strBuffer)
  24.             ' see if the line contains the word
  25.             intPos = InStr(1, strBuffer, WORD_TO_BE_FOUND)
  26.             If intPos > 0 Then
  27.                 ' color the line blue
  28.                 .SelStart = lngTotLength
  29.                 .SelLength = lngLength
  30.                 .SelColor = vbBlue
  31.                 ' color the word red
  32.                 .SelStart = intPos + lngTotLength - 1
  33.                 .SelLength = Len(WORD_TO_BE_FOUND)
  34.                 .SelColor = vbRed
  35.             End If
  36.             ' Accumulate the total characters read
  37.             lngTotLength = lngTotLength + lngLength
  38.         Next
  39.     End With
  40. End Sub