模块部分:Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal Hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const EM_GETLINECOUNT = &HBA
Public Function Lines(ByVal YourText As TextBox) As Long
Dim Hwnd As Long
Hwnd = YourText.Hwnd
Lines = SendMessage(Hwnd, EM_GETLINECOUNT, 0, 0)
End Function
调用:Call MsgBox("当前文本行数:" & Lines(Text1))