|
Anthony's VBA Forum Where the knowledge is shared |
|
|
View previous topic :: View next topic |
Author |
Message |
blaq78
Joined: 31 Oct 2008 Posts: 2 Location: Canada
|
Posted: Mon Dec 29, 2008 5:42 pm Post subject: Userforms Help-Please |
|
|
I have two questions. First, how do i get the userform to stay active when a user clicks the enter key and is there a way to write a code for the enter key to act as tab?
Secondly, i need to put Back buttons on my userforms and to be able to go back and edit a previous form if need be, how can this be done?
Thanks for your help.
blaq |
|
Back to top |
|
|
Kenneth Hobson Gold Member
Joined: 25 Mar 2007 Posts: 21 Location: Tecumseh, OK
|
Posted: Wed Mar 04, 2009 10:54 pm Post subject: |
|
|
The Enter key issue depends on what controls you want to use for that behavior. For Textbox controls, set the EnterKeyBehavior=True. Be sure to set the TagIndex values. For CommandButton controls, you will need to use its KeyDown event to check like this:
[code]Private Sub CommandButton1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then TextBox1.SetFocus
End Sub[/code]
For question 2, you could use a Multipage control. Or something like:
[code]Private Sub CommandButton1_Click()
UserForm1.Show
Unload Me
End Sub[quote][/quote][/code] |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|