LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default SetFocus in user form

Dennis later said in a separate thread:

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

so even he doesn't appear to be still enamored with his suggeste solution.

--
Regards,
Tom Ogilvy

"John Tjia" wrote in message
m...
Thanks to all! The .SelStart = 0, .SelLength = Len(.Text) code is
great.

Dennis, I tried your code, but VBA didn't accept the .SendKeys{LEFT}.
I saw something once that was the equivalent of a Tab command in the
userform, i.e., set the focus on the next item in the tab order, and
then do a Shift+Tab equivalent to back up. Thanks for the reply.


(DennisE) wrote in message

...
John,

I'm not sure about the highlighting aspect of your question, but here's

what
you can do to shift the insertion point to the left of the zero:

With UserForm1.TextBox1
.Text = "0"
.SetFocus
.SendKeys{LEFT}
End With

-- Dennis Eisen



 
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
user form Ruth Excel Discussion (Misc queries) 3 October 30th 08 12:51 PM
user form Jase Excel Discussion (Misc queries) 1 March 25th 08 09:51 PM
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
User form Mike Rogers New Users to Excel 7 December 16th 05 05:07 PM
I am looking to see if anybody has an equivalant user form to Outlooks CONTACT form BruceJ[_2_] Excel Programming 2 October 15th 03 05:28 PM


All times are GMT +1. The time now is 07:58 PM.

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

About Us

"It's about Microsoft Excel"