View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
DennisE DennisE is offline
external usenet poster
 
Posts: 66
Default SetFocus in user form

John,

I was (incorrectly) trying to recall from
memory the form of the SendKeys that would do the shifting. The correct form
of the instruction is as follows, and will
result in "AB|C" showing up in the
TextBox, rather than "ABC|".

Sub ShiftLeft( )
UserForm1.TextBox1.Text = "ABC"
Application.SendKeys ("{LEFT}")
UserForm1.Show
End Sub

And to be precise about the .SelLength and .SelStart properties, you'd want to
use .SelStart = Len(.Text) - 1 and
..SelLength = 1 to get you to shift the
insertion point one character to the left
and highlight the rightmost character.

-- Dennis Eisen