put cursor on position in textbox VBA

ingrid

Registered User.
Local time
Today, 15:52
Joined
Apr 10, 2003
Messages
42
Is it possible in VBA to put the cursor on a specified position in aan textbox?

F.E.

I have a textbox with "Ingrid"
I want the cursor to be after the "g"
 
Last edited:
Look up the SelStart property.
 
Yes Selstart should do that. Relatedly, how would you insert text at the location of the cursor by using code? (not at the end of the existing text)
 
How about:

Code:
Me.txtSample = Mid(Me.txtSample, 1, Me.txtSample.SelStart - 1) & _
               Me.NewText & _
               Mid(Me.txtSample, Me.txtSample.SelStart)

Wayne
 
You're right! I forgot that you can read SelStart to get the current cursorposition :o

Greetz!
 
Strangely, this is not working for me in Access 2000. I get an 'Invalid procedure call or argument'. I tried it out in VB 6 and it works fine and actually it looks very right. Me.txtSample.SelStart always evaluates to 0 when I debug, regardless of whats selected or the position of the cursor.
 
I can't test it in Access 2000, but in Access XP it works fine
 

Users who are viewing this thread

Back
Top Bottom