Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Mailmerge Dates
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 |
#3
|
|||
|
|||
That's got it! - Thanks.
"Charles Kenyon" wrote: 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. -- 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. "Greg Smart" Greg wrote in message ... 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 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Textboxes in Mailmerge? | Mailmerge | |||
Tracking Changes - Entering dates of changes | Microsoft Word Help | |||
Included Property in Word 2003 MailMerge | Mailmerge | |||
How do I compare dates in a Word IF field? | Microsoft Word Help | |||
How do I compare dates in a Word IF field? | Microsoft Word Help |