O
odekkers
I have some problems with the SetFocus command in a Userform with an
AfterUpdate or BeforeUpdate routine.
To make it clear to you, I made a very small Userform to demonstrate it. It
only contains 8 TextBoxes and this code:
Code:
Private Sub TextBox01_AfterUpdate()
Me.TextBox08.SetFocus
End Sub
-
Private Sub TextBox02_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
TextBox08.SetFocus
End Sub
-
Private Sub TextBox03_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox08.SetFocus
End Sub
-
Private Sub TextBox04_Change()
TextBox08.SetFocus
End Sub
I expected that in all cases, the focus should be set to TextBox08, but this
only happens with the Change event.
Do you have any suggestions how I can set the focus to TextBox08 in an
AfterUpdate or BeforeUpdate event?
I use Excel 2007
Kind regards,
Otto.
AfterUpdate or BeforeUpdate routine.
To make it clear to you, I made a very small Userform to demonstrate it. It
only contains 8 TextBoxes and this code:
Code:
Private Sub TextBox01_AfterUpdate()
Me.TextBox08.SetFocus
End Sub
-
Private Sub TextBox02_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
TextBox08.SetFocus
End Sub
-
Private Sub TextBox03_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox08.SetFocus
End Sub
-
Private Sub TextBox04_Change()
TextBox08.SetFocus
End Sub
I expected that in all cases, the focus should be set to TextBox08, but this
only happens with the Change event.
Do you have any suggestions how I can set the focus to TextBox08 in an
AfterUpdate or BeforeUpdate event?
I use Excel 2007
Kind regards,
Otto.