Mailmerge Dates

G

gregory.smart

I'm trying to do a mailmerge from Excell and I want the date from excell to
print out as

"st" or "nd" or "rd" or "th" of "month" ", " yyyy


Example. "3rd day of March, 2005"


I have the following function from access. Any help?


' This function formats a date in the formal legal fashion:
' 20th day of February, 2001

Dim strDay As String
Dim strMonth As String
Dim strYear As String

strDay = CStr(Day(dtToday))
strMonth = Format$(dtToday, "mmmm")
strYear = CStr(Year(dtToday))

If Len(Trim(strDay)) = 2 And Left$(strDay, 1) = "1" Then
FormalDate = strDay & "th day of " & strMonth & ", " & strYear
Else
Select Case Right$(strDay, 1)
Case "1"
FormalDate = strDay & "st day of " & strMonth & ", " & strYear
Case "2"
FormalDate = strDay & "nd day of " & strMonth & ", " & strYear
Case "3"
FormalDate = strDay & "rd day of " & strMonth & ", " & strYear
Case Else
FormalDate = strDay & "th day of " & strMonth & ", " & strYear
End Select
End If

End Function

Sincerly,

Greg Smart
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top