Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find position of cursor in text box
Is there a way I can determine the position of the cursor in a text box in a
custom form? Reason - if the user has just typed a CR/LF I want the macro to add in a bullet point. I've made this happen when the cursor is at the end of the text by putting the following in an On Change macro if right(mytext,2) = chr(13) & chr(10) then mytext = mytext & chr(149) & chr(32) but I'm struggling for a method that works when the cursor is in the middle of the text. -- Adrian D.Bailey, Information and Systems Manager, Dept.Human Sciences Loughborough University, Loughborough Leics, LE11 3TU, UK. Tel: 01509 223007 Fax: 01509 223940 Community Warden, Storer and Burleigh Areas. Out-of-hours Tel: 01509 563263 -- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find position of cursor in text box
SelStart should do it if I understand you.
Private Sub TextBox1_Change() Debug.Print TextBox1.SelStart End Sub -- Jim "Adrian D. Bailey" wrote in message ... | Is there a way I can determine the position of the cursor in a text box in a | custom form? | | Reason - if the user has just typed a CR/LF I want the macro to add in a | bullet point. | I've made this happen when the cursor is at the end of the text by putting | the following in an On Change macro | if right(mytext,2) = chr(13) & chr(10) then mytext = mytext & chr(149) & | chr(32) | but I'm struggling for a method that works when the cursor is in the middle | of the text. | | -- | Adrian D.Bailey, Information and Systems Manager, Dept.Human Sciences | Loughborough University, Loughborough Leics, LE11 3TU, UK. | Tel: 01509 223007 Fax: 01509 223940 | | Community Warden, Storer and Burleigh Areas. Out-of-hours Tel: 01509 563263 | -- | | |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to find a text in a string without giving the position of the | Excel Discussion (Misc queries) | |||
find number position in excel text cell | Excel Discussion (Misc queries) | |||
Problem with cursor position after Find is run. | Excel Programming | |||
Retrieving text being typed and cursor position using VBA or automation, how? | Excel Programming | |||
How do I get cursor position and text being typed? | Excel Programming |