ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find textbox insertion point (https://www.excelbanter.com/excel-programming/410556-find-textbox-insertion-point.html)

Bert[_7_]

find textbox insertion point
 
Is there a way to test for the current insertion point in a Userform
textbox--if, for example, there are 100 characters in the textbox, and the
user clicks at a point in the textbox, is there a way to find out where in
the string the user has clicked.
Thanks.



JLGWhiz

find textbox insertion point
 
Look at the SelStart Property in VBA help. I think that is what you are
looking for.

"Bert" wrote:

Is there a way to test for the current insertion point in a Userform
textbox--if, for example, there are 100 characters in the textbox, and the
user clicks at a point in the textbox, is there a way to find out where in
the string the user has clicked.
Thanks.




Peter T

find textbox insertion point
 
Private Sub TextBox1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 Then
With TextBox1
Me.Caption = .CurLine & " " & .SelStart & " " & .SelLength
End With
End If
End Sub

Regards,
Peter T

"Bert" wrote in message
news:F14Uj.8546$Jb2.8467@trndny03...
Is there a way to test for the current insertion point in a Userform
textbox--if, for example, there are 100 characters in the textbox, and the
user clicks at a point in the textbox, is there a way to find out where in
the string the user has clicked.
Thanks.





Bert[_7_]

find textbox insertion point
 
Thanks...that's exactly what I need.

"Peter T" <peter_t@discussions wrote in message
...
Private Sub TextBox1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 1 Then
With TextBox1
Me.Caption = .CurLine & " " & .SelStart & " " & .SelLength
End With
End If
End Sub

Regards,
Peter T

"Bert" wrote in message
news:F14Uj.8546$Jb2.8467@trndny03...
Is there a way to test for the current insertion point in a Userform
textbox--if, for example, there are 100 characters in the textbox, and
the
user clicks at a point in the textbox, is there a way to find out where
in
the string the user has clicked.
Thanks.







Bert[_7_]

find textbox insertion point
 
Thanks. That's what I was looking for.

"JLGWhiz" wrote in message
...
Look at the SelStart Property in VBA help. I think that is what you are
looking for.

"Bert" wrote:

Is there a way to test for the current insertion point in a Userform
textbox--if, for example, there are 100 characters in the textbox, and
the
user clicks at a point in the textbox, is there a way to find out where
in
the string the user has clicked.
Thanks.







All times are GMT +1. The time now is 03:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com