Thread: [Solved] 2 date issues
View Single Post
 
Old 02-11-2013, 02:50 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,338
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Gordon,

For the first problem, try something based on:
Code:
Private Sub Calendar1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox1.Text = Format(Calendar1.Value, "DDDD ") & Ordinal(Calendar1.Day) & Format(Calendar1.Value, " MMMM YYYY")
End Sub
 
Function Ordinal(Val As Integer) As String
Dim strOrd As String
If (Val Mod 100) < 11 Or (Val Mod 100) > 13 Then strOrd = Choose(Val Mod 10, "st", "nd", "rd") & ""
Ordinal = Val & IIf(strOrd = "", "th", strOrd)
End Function
As for the second problem, have you validated the date value that is being obtained from the workbook?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote