Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find a text in a string without giving the position of the Sreekanth Excel Discussion (Misc queries) 2 April 15th 10 09:07 PM
find number position in excel text cell Don Excel Discussion (Misc queries) 5 April 7th 06 09:34 PM
Problem with cursor position after Find is run. excelnut1954 Excel Programming 3 February 22nd 06 07:34 PM
Retrieving text being typed and cursor position using VBA or automation, how? Kallepalle Excel Programming 2 May 23rd 04 12:40 PM
How do I get cursor position and text being typed? Kallepalle Excel Programming 2 February 19th 04 05:49 PM


All times are GMT +1. The time now is 02:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"