LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default SetFocus Not working

Hello. I have a userform with a textbox and a commandbutton that are not
working as expected with regard to setfocus.

After commandbutton3 is clicked, I want to set the focus to textbox3. This
works just fine. However, I have a keydown event in textbox3 that runs
commandbutton3_click sub if the enter key is pressed. When this event runs,
everything works except textbox3.setfocus. Any help is appreciated.

Private Sub CommandButton3_Click()
If TextBox3.Value < Empty Then
ListBox1.AddItem TextBox3.Value
TextBox3.Value = Empty
TextBox3.SetFocus
End If
End Sub

Private Sub TextBox3_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = 13 Then
CommandButton3_Click
End If
End Sub


--
Thanks,
Mike
 
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
setfocus ranswrt Excel Programming 2 July 22nd 08 02:56 AM
SetFocus not working WLMPilot Excel Programming 4 February 15th 08 04:29 PM
SetFocus not working as I would expect [email protected] Excel Programming 0 May 3rd 07 02:37 AM
SetFocus not working Henry T Excel Programming 1 September 15th 05 05:33 PM
setfocus Dean Reardon Excel Programming 2 December 15th 04 12:18 PM


All times are GMT +1. The time now is 08:11 PM.

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"