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
Charles Kenyon - 18 Mar 2005 18:46 GMT
It will depend on whether Word recognizes the result as a date. The
following would give the result you want on a DATE field. You could try it
with your mergefield date and see what happens.
{ Date \@ "d" \* ordinal } would give you 18th today.
So try { MergeField Date \@ "d" \* ordinal } and see what happens.
See http://addbalance.com/word/datefields1.htm for more on formatting date
fields to get the rest of your date if the above works. Please let me know.

Signature
Charles Kenyon
Word New User FAQ & Web Directory: http://addbalance.com/word
Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
> I'm trying to do a mailmerge from Excell and I want the date from excell
> to
[quoted text clipped - 37 lines]
>
> Greg Smart
gregory.smart@us.army.mil - 18 Mar 2005 20:26 GMT
That's got it! - Thanks.
> It will depend on whether Word recognizes the result as a date. The
> following would give the result you want on a DATE field. You could try it
[quoted text clipped - 47 lines]
> >
> > Greg Smart