View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default UserForm text box Date formatting

userform controls have no mask or validation capabilities inherent in their
properties or methods.

Private Sub Textbox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
sStr = Userform1.Textbox1.Text
if not isDate(sStr) then
Userform.Textbox1.Text = ""
msgbox "Bad date in Textbox1"
cancel = True
end if
End sub

--
Regards,
Tom Ogivy

"Dan" wrote in message
...
I have a UserForm textbox being used to capture a date. I
want to stop the user, on the UserForm, if the date is not
inputed correctly (01/01/04) or if a non-date is inputed.
Last night, I had a suggestion to use the IsDate function
but I am a newbie. Is the "Input Mask" feature, used in MS
Access, available in VBA? Can you give me suggestions on
how to use IsDate or a better solution?

Thanks.