Insert these 2 procedires in your code.
Code:
Public Function NumberOfLines(TextBox As RichTextBox) As Integer
Dim sLines() As String
sLines() = Split(TextBox.Text, vbCrLf)
NumberOfLines = UBound(sLines) + 1
End Function
Public Function CurrentLine(TextBox As RichTextBox) As Integer
Dim sCopy As String
Dim sLines() As String
Dim intCon As Integer
sCopy = TextBox.Text
sCopy = Mid(sCopy, 1, TextBox.SelStart) & "{VBROCKS}" & Mid(sCopy, TextBox.SelStart + 1)
sLines() = Split(sCopy, vbCrLf)
For intCon = 0 To UBound(sLines())
If InStr(1, sLines(intCon), "{VBROCKS}") Then
CurrentLine = intCon + 1
Exit For
End If
Next
End Function
Now to determine the number of lines in the rich text box, u could call it like this
Code:
Msgbox NumberOfLines(MyRTFBox)
To determine the current line
Code:
Msgbox CurrentLine(MyRTFBox)