Positioning the Insertion Point in a TextBox

  • Thread starter Thread starter DennisE
  • Start date Start date
D

DennisE

I've been wrestling with this one for days, and I just can't
seem to pull it off. What I'd like to do when a certain TextBox
on a UserForm takes the focus is to have the insertion point
automatically move one space to the left. So, for example,
if the TextBox contains ""ABC" upon taking the focus what
I want to see is "AB|C"; I've been trying to do this by using
Application.SendKeys "{LEFT}" in some manner but to no
avail. I can obviously do it manually by pressing the left arrow
key, but I want to do it in VBA so as to remind the user of how
the data entry appearing in that particular TextBox is to be
modified. Anyone have any ideas on how to do this?

-- Dennis Eisen
 
Check out the "selstart" property of the textbox.
Setting selstart to len(textbox text)-1 and sellength to 0 should do
it.
Tim
 
Back
Top