I find one annoying bug in "SelectedText" property of Textbox control. When you ask for selected text in a particular selection scenario it fail and
give the selected text except the last charachter.
To reproduce the issue you need to select some text inside textbox starting from last char to the first one and you will see that selected text
will not contain the last char.
To fix this issue and to see it in your code I use the following code (I use windows api directly on textbox hwnd to get the real selection length):
Code: Select all
Public Property Get SelLength() As Long Debug.Print (Len(txtText.SelectedText)) Dim startpos As Long Dim endpos As Long Call SendMessage(txtText.hWnd, EM_GETSEL, startpos, endpos) SelLength = endpos - startpos End Property