Please add the following to the KeyUp (or KeyDown) event of Text1
Place cursor at the beginning of a word and press F-12. The word will be selected, as expected.
If you break execution manually (Ctrl-Break), the Immediate Window will reveal the selection as made:Quote:
' Key Up
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
' F-12
If KeyCode = 123 Then
SendKeys "^+{LEFT}"
End If
End Sub
Cut, Copy, Del, and other actions will also work.Quote:
? Text1.SelText
? Text1.SelLength
However, if you try to peek at the the selection with MsgBox:
Nothing will be shown as selected!Quote:
' Key Up
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
' F-12
If KeyCode = 123 Then
SendKeys "^+{LEFT}"
MsgBox(Text1.SelText)
End If
End Sub
Obviously, the selection is made, but not at this point!
So, what is going on? And, more to the point, how could I trap and use the selection ?
