Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, _
ByVal lParam As Any) As Long
Private Const EM_GETLINECOUNT As Long = &HBA
Private Function GetLineCount(TBox As TextBox) As Long
' Fungerar även med RichTextBox (TBox As RichTextBox)
GetLineCount = SendMessage(TBox.hwnd, EM_GETLINECOUNT, -1, vbNullString)
End Function