Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Current Date On a Userform 2

Status
Not open for further replies.

robcarr

Programmer
May 15, 2002
633
GB
Dear All,

I would like to display the current date on a user form in the format of "dd-mmmm-yy", I can do this using a label, but it only works when the mouse is moved over the label, how can I get the date to be displayed automatically when the user form is displayed, also I would like to set the value of a calendar control to always go to the current date first.

Thanks
 
Hi rob
This should do the trick for the display. There are two options here, take your pick!

Private Sub UserForm_Initialize()
Me.Label1.Caption = "Today is " & Format(Now(), "dd-mmmm-yy")
Me.Caption = "Today is " & Format(Now(), "dd-mmmm-yy")
End Sub

Never used calenders so I can't help there I'm afraid:-(

Happy Friday
;-) If a man says something and there are no women there to hear him, is he still wrong?
 

Do:

Private Sub UserForm_Initialize()

Label1 = Format(Date, "dd-mmmm-yy")

End Sub
 
thanks for doing that great help, I also added a time stamp to the formula as well.
Regards
 
If you have enabled the calendar function I believe I have done this:


Private Sub UserForm_Initialize()
Calendar1.Value = Date
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top