<pre class=code>Option Explicit
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const EM_GETLINECOUNT = &HBA
Public Function GetLineCount(Txt As TextBox)
Dim lngLineCount As Long
On Error Resume Next
lngLineCount = SendMessageLong(Txt.hwnd, EM_GETLINECOUNT, 0&, 0&)
GetLineCount = Format$(lngLineCount, "##,###")
End Function</pre>
Private Sub Command1_Click()
MsgBox GetLineCount(Text1)
End Sub