Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default How do you SETFOCUS on TextBox

I have two MODELESS UserForms and I need to have the Textbox1 come up with
the Focus when UserForm2 is Activated. Also, I need to leave UserForm2
Loaded so I just use SHOW and HIDE. The PROBLEM: When UserForm2 is LOADED
(Button1), Textbox1 DOES come up with the Focus. However, after I HIDE it
(Button2) and then reactivate it (Button1), the focus is gone. I can't seem
to find and way of getting the focus back AUTOMATICALLY after the first
Activation.

IN USERFORM1:
Private Sub CommandButton1_Click()
Userform2.Show
Userform2.Top = 300 'just to offset it from UserForm1
End Sub

Private Sub CommandButton2_Click()
Userform2.Hide
End Sub





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default How do you SETFOCUS on TextBox

Forgot to say that TextBox1 is in UserForm2.

Mike

"Mike" wrote in message
...
I have two MODELESS UserForms and I need to have the Textbox1 come up with
the Focus when UserForm2 is Activated. Also, I need to leave UserForm2
Loaded so I just use SHOW and HIDE. The PROBLEM: When UserForm2 is LOADED
(Button1), Textbox1 DOES come up with the Focus. However, after I HIDE it
(Button2) and then reactivate it (Button1), the focus is gone. I can't seem
to find and way of getting the focus back AUTOMATICALLY after the first
Activation.

IN USERFORM1:
Private Sub CommandButton1_Click()
Userform2.Show
Userform2.Top = 300 'just to offset it from UserForm1
End Sub

Private Sub CommandButton2_Click()
Userform2.Hide
End Sub







  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default How do you SETFOCUS on TextBox

Try using setfocus in the userform_activate on userform2

Private Sub UserForm_Activate()
Me.TextBox1.SetFocus

End Sub

--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Mike" wrote:

Forgot to say that TextBox1 is in UserForm2.

Mike

"Mike" wrote in message
...
I have two MODELESS UserForms and I need to have the Textbox1 come up with
the Focus when UserForm2 is Activated. Also, I need to leave UserForm2
Loaded so I just use SHOW and HIDE. The PROBLEM: When UserForm2 is LOADED
(Button1), Textbox1 DOES come up with the Focus. However, after I HIDE it
(Button2) and then reactivate it (Button1), the focus is gone. I can't seem
to find and way of getting the focus back AUTOMATICALLY after the first
Activation.

IN USERFORM1:
Private Sub CommandButton1_Click()
Userform2.Show
Userform2.Top = 300 'just to offset it from UserForm1
End Sub

Private Sub CommandButton2_Click()
Userform2.Hide
End Sub








  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default How do you SETFOCUS on TextBox

Thanks Martin, but that doesn't seem to work.

mike
"Martin Fishlock" wrote in message
...
Try using setfocus in the userform_activate on userform2

Private Sub UserForm_Activate()
Me.TextBox1.SetFocus

End Sub

--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Mike" wrote:

Forgot to say that TextBox1 is in UserForm2.

Mike

"Mike" wrote in message
...
I have two MODELESS UserForms and I need to have the Textbox1 come up
with
the Focus when UserForm2 is Activated. Also, I need to leave UserForm2
Loaded so I just use SHOW and HIDE. The PROBLEM: When UserForm2 is
LOADED
(Button1), Textbox1 DOES come up with the Focus. However, after I HIDE
it
(Button2) and then reactivate it (Button1), the focus is gone. I can't
seem
to find and way of getting the focus back AUTOMATICALLY after the first
Activation.

IN USERFORM1:
Private Sub CommandButton1_Click()
Userform2.Show
Userform2.Top = 300 'just to offset it from UserForm1
End Sub

Private Sub CommandButton2_Click()
Userform2.Hide
End Sub










Reply
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
Having problems with textbox setfocus Terry K Excel Programming 1 May 9th 06 02:23 PM
setfocus in textbox on multipage Martin Excel Programming 5 January 6th 06 04:20 AM
SetFocus to first textbox on userform upon Userform1.Show Paul Simon[_3_] Excel Programming 6 February 11th 04 04:31 PM
TextBox SetFocus Problem Tom Ogilvy Excel Programming 1 September 12th 03 01:27 PM
TextBox.SetFocus steve Excel Programming 4 July 16th 03 07:40 PM


All times are GMT +1. The time now is 07:46 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"