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

I forgets? maybe it is available anyway?

I'm so used to using DEV PCs I forget what is available!

If the masked control is not available, then use a text box. I like it better that way since you can type in what ever
date format you like e.g. 13-1-05 or 13-Jan-2005 or 13/01/05.

The error handling in the sub is very broad & should catch silly entries!

(aside note: I hate date formats! to some, 1/6/04 was very cold & to others, it was 1-Jun-2004)

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ...
I don't believe the masked edit control is part of Excel.

--

Vasant


"Stevie_mac" wrote in message
...
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