Hi Bob
I found this KB
OFF2000: Exit Event for TextBox in a Frame Does Not Run Correctly
http://support.microsoft.com/default...34&Product=xlw
Me neither, other than to get rid of frames<VBG
I think this was my solution then<g
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl
"Bob Phillips" wrote in message ...
Hi Ron,
Me neither, other than to get rid of frames<VBG
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Ron de Bruin" wrote in message
...
Hi Bob
Now I remember it that I have this problem ones.
But I can't remember the workeround.
I try to find it
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl
"Bob Phillips" wrote in message
...
Ron,
The frame is the problem.
The tab out fires the Frame exit event not the textbox exit event.
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"Ron de Bruin" wrote in message
...
You must set Cancel to True Jamal
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1.Value < 100 Then
Cancel = True
MsgBox "You must enter ....."
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
End If
End Sub
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl
"Jamal" wrote in message
...
I am trying to write code so that when the value entered
in a textbox does not meet certain criteria, the text in
the textbox is selected for correction by the user. Please
see the code below.
Once the user presses the tab key the message is displayed
but the focus is lost and goes on to the next textbox or
next frame if the textbox is the last one in the current
frame. I have tried before update and change as well as
exit. What am I doing wrong? How can I get it to go back
and highlight the textbox with incorrect text/value.
Thanks for your help.
Private Sub TextBox1_Exit(ByVal Cancel As
MSForms.ReturnBoolean)
If TextBox1.Value < 100 Then
msgbox "You must enter ....."
TextBox1.SetFocus
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
End Sub