Dave Hawley Help Again!!


Posted by Christine on March 28, 2001 1:11 AM

Hi David

Further to my message on Mr Excel, can I ask for your assistance again.

Is there any way that I can use your code to have the user cancel the form if they want too. As your code stands, when the user wants to cancel the form, it is still asking for a date value first.

******************************************************************

Hi One and All.

Hi Christine

I can't help but help a fellow Oz.

Try this:

Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

If TextBox1.Value = "" Then
Cancel = True
MsgBox "You must enter a value!"
Exit Sub
Else: Select Case TextBox1
Case IsNumeric(TextBox1)
MsgBox "Number"
Case Else
MsgBox "Text"
End Select
Cancel = False
End If
End Sub



Posted by Dave Hawley on March 28, 2001 3:32 AM

Hi Christine

Is this suitable ?

Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim Reply As Integer
If TextBox1.Value = "" Then
Reply = MsgBox("You must enter a value! Or select cancel " _
& "to exit the form", vbOKCancel, "Crocodile Christine!")
If Reply = vbCancel Then End
Cancel = True
Exit Sub
Else: Select Case TextBox1
Case IsNumeric(TextBox1)
MsgBox "Number"
Case Else
MsgBox "Text"
End Select
Cancel = False
End If
End Sub

Dave

OzGrid Business Applications