Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
Put similar code in the Frame exit event?
-- Regards, Tom Ogilvy "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 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
Tom,
I tried that. Problem comes when that frame has more than one textbox, you don't get the error until the whole frame is tabbed out of, and the focus stays on the last textbox. It's a real nasty/ -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Tom Ogilvy" wrote in message ... Put similar code in the Frame exit event? -- Regards, Tom Ogilvy "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 |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
It's a real nasty/
MSForms Frames have kind of been like that in general. <g -- Regards, Tom Ogilvy "Bob Phillips" wrote in message ... Tom, I tried that. Problem comes when that frame has more than one textbox, you don't get the error until the whole frame is tabbed out of, and the focus stays on the last textbox. It's a real nasty/ -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Tom Ogilvy" wrote in message ... Put similar code in the Frame exit event? -- Regards, Tom Ogilvy "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 |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
Woudn't the textbox exit code fire in those cases ?
-- HTH. Best wishes Harald Followup to newsgroup only please "Bob Phillips" skrev i melding ... Tom, I tried that. Problem comes when that frame has more than one textbox, you don't get the error until the whole frame is tabbed out of, and the focus stays on the last textbox. |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Text Box exit
Harald,
Only after you exit the frame, and as I said, it doesn't setfocus to the first textbox. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Harald Staff" wrote in message ... Woudn't the textbox exit code fire in those cases ? -- HTH. Best wishes Harald Followup to newsgroup only please "Bob Phillips" skrev i melding ... Tom, I tried that. Problem comes when that frame has more than one textbox, you don't get the error until the whole frame is tabbed out of, and the focus stays on the last textbox. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Exit Sub | Excel Discussion (Misc queries) | |||
Run when exit | Excel Worksheet Functions | |||
exit object | Excel Discussion (Misc queries) | |||
on exit macro | Excel Discussion (Misc queries) | |||
Exit Sub? | Excel Programming |