View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Forcing a date entry?

Hi Marcotte,

With reference to the calendar control installation issues, see Ron de
Bruin's notes:
http://www.fontstuff.com/vba/vbatut07.htm
See in particular Ron's comments vis-a-vis Office Professional and Access.

To validate your users' textbox date entries, you can use VBA's IsDate
function, e.g. something like:

If IsDate(TextBox1.Text) Then
'Valid Date
'Your code
Else
TextBox1.Text = ""
MsgBox "Invalid date" & vbNewLine _
& "Date must be prior to 1/1/2005 - Please re-enter"
',,,,,,,,,,,,,,,,,,,,,,,
End If


---
Regards,
Norman

"Marcotte A" wrote in message
...
"Norman Jones" wrote:

Hi Junior,

Why not use a pop-up calendar control for the relevant cells?

For Ron de Bruin's code and instructions see:

http://www.rondebruin.nl/calendar.htm


I have a similar problem. I have a text box on a user form where the user

enters a date. I'm having trouble verifying that a valid date was entered.
Using a Calendar would be great. However, after I downloaded and installed
mscal.ocx I'm still having trouble adding a calendar to my user form. I've
added the calendar control to the tool box, but when I try to draw it on the
userform I get the message "Library not registered." with an OK and Help
button. Pressing help opens a help window with absolutely nothing in it.
I'm running XL 2003 on Win XP and installed mscal.ocx in c:\windows\system32
using Start....Run..."regsvr32 mscal.ocx " as instructed by the link on Rons
page. Am I doing something wrong? Is there an easy way (without using a
calendar - since I would have to install this on other computers as well) to
make a text box only accept dates? TIA
Marcotte