View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stevie_mac Stevie_mac is offline
external usenet poster
 
Posts: 39
Default Date Transfer to userform

1. Use Masked Edit (right click Toolbox, additional controls)
Set the mask property to ##/##/##

2. add a button that, when clicked, reads the date entered & populates the other boxes...

Private Sub CommandButton1_Click()

On Error GoTo FAIL

TextBox1 = Format(CDate(MaskEdBox1.Text), "dddd")
TextBox2 = Format(CDate(MaskEdBox1.Text), "dd")
TextBox3 = Format(CDate(MaskEdBox1.Text), "MMMM")
TextBox4 = Format(CDate(MaskEdBox1.Text), "yy")

Exit Sub
FAIL:
MsgBox "Please check the date entered is valid", vbCritical, "Error"
End Sub

I do however, recommend you use yyyy (4 digit year)

Regards - Steve.


"MBlake" wrote in message ...
Hi,
On a User From I have a text box where the user enters a date. Two queries that I have not yet been able to sort out
/ find an answer - I would be grateful if someone could assist me.

1. On a user form text box - Is it possible to restrict the user to a particular date format? i.e. 27/05/05

2. On a userform, Once a user enters the date of their order/activity, how do I have that date transferred to 4 text
boxes to display in 4 textnoxes the day of week, month, year and date. i.e. user enters 15/05/05 and the text boxes
are populated automatically with Monday - 15 - May - 2005

Any help would be fantastic,
Thanks,
Mickey