Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancel = True Validate Word 2000

Status
Not open for further replies.

vbaprogammer

Programmer
Sep 16, 1999
59
US
I can't get the cursor back into the textbox (or list, or combo) in Word 2000. This does work in Word 97, though.

Can anyone help?

Private Sub Textbox1_Exit (ByVal Cancel as MSForms.ReturnBoolean)
If Not IsNumeric(TextBox1.Text) Then
MsgBox "Please enter a numeric value"
Cancel = True
End If
End Sub
 
Try just manually putting the cursor back in the text box after your messege.

Private Sub Textbox1_Exit (ByVal Cancel as MSForms.ReturnBoolean)
If Not IsNumeric(TextBox1.Text) Then
MsgBox "Please enter a numeric value"
Cancel = True
TextBox1.SetFocus
End If
End Sub

That should do it. You could also use the LostFocus procedure of the textbox instead of the Exit procedure. -Dustin
Rom 8:28
 
Believe it or no, that doesn't work either. I'm at a loss.

Word VBA has no LostFocus event in a textbox. It's wierd. Many things in VB, Excel VBA, Access VBA are not in Word VBA, said "Ripley."

I honestly believe that the cursor is in the textbox, but it isn't visible. I can use TextBox1.Text = "" and that works, but still no cursor (insertion point). And, without a cursor, I have to click on the textbox before editing.

This may be a bug, but its a very troublesome one when I think that the user has to reclick the textbox when an error occurs.

Any other possible solutions?

Thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top