If I understand you correctly, you want to format your text line by line. If this is the case then you can use a couple of API calls to get every line for your RichTextBox:

Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SendMessageString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As String) As Long
Private Const EM_GETLINE = &HC4
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_LINEINDEX = &HBB
Private Const EM_LINELENGTH = &HC1

Private Sub Command1_Click()
    Dim strBuffer As String
    Dim lngLineLength As Long
    Dim lRet As Long
    Dim i As Long
    Dim lngCount As Long
    Dim lngIndex As Long
    Dim strFullString As String
    
    lngCount = SendMessage(RichTextBox1.hwnd, EM_GETLINECOUNT, 0, 0)
    
    For i = 0 To lngCount - 1
        lngIndex = SendMessage(RichTextBox1.hwnd, EM_LINEINDEX, i, 0)
        lngLineLength = SendMessage(RichTextBox1.hwnd, EM_LINELENGTH, lngIndex, 0)
        strBuffer = Space(lngLineLength)
        Call SendMessageString(RichTextBox1.hwnd, EM_GETLINE, i, ByVal strBuffer)
        'strBuffer now holds the line of text
        'Format it the way you want it and
        'append it to the Full string
        strFullString = strFullString & strBuffer & vbCrLf
    Next
    'Replace the text in the RichTextBox with the formated string
    RichTextBox1.Text = strFullString
End Sub
I hope this what you're looking for,

------------------

Serge

Software Developer
[email protected]
[email protected]
ICQ#: 51055819