Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm text box Date formatting
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm text box Date formatting
Thanks Tom, you have been big help. Dan
-----Original Message----- 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. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date formatting from text | Excel Discussion (Misc queries) | |||
Text & Date Formatting | Excel Worksheet Functions | |||
Formatting text and date together | Excel Discussion (Misc queries) | |||
Date formatting a text box | Excel Programming | |||
formatting text in TextBox in UserForm | Excel Programming |