How to Count the Number of lines in a Text Box
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 'Controls - How to Count the Number of lines in a Text Box Option Explicit Private Declare Function SendMessageAsLong 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 = 186 Public Function GetLineCount(ByRef txt As TextBox) As Long GetLineCount = SendMessageAsLong(Text1.hWnd, EM_GETLINECOUNT, 0, 0) End Function 'How can I use this function: Sub Main() Debug.Print GetLineCount(Text1) End Sub |
Related posts:
- How to count number of lines in a Text box
- How to count number of lines in a text file
- How to count number of characters in RTF except crlf and spaces? (in two ways)
- How to count the number of textboxes in a form
- How to count number of files in a given directory (in two ways)
- How to find last 120 lines in a text file
- How to Get the current line from the Text Box
- How to Link a text box to a list box? So, as you type, it highlights any matching entries
- How to scan List Box for the text in TextBox
- How do I find the number of characters in a text box?