#1   Report Post  
Greg Smart
 
Posts: n/a
Default 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


  #2   Report Post  
Charles Kenyon
 
Posts: n/a
Default

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




  #3   Report Post  
 
Posts: n/a
Default

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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Textboxes in Mailmerge? zSplash Mailmerge 5 March 22nd 05 09:01 PM
Tracking Changes - Entering dates of changes Lisa Glase Microsoft Word Help 1 March 3rd 05 10:14 AM
Included Property in Word 2003 MailMerge Alessio Mailmerge 1 December 23rd 04 11:26 AM
How do I compare dates in a Word IF field? Marion G Microsoft Word Help 0 December 10th 04 01:49 AM
How do I compare dates in a Word IF field? Marion G Microsoft Word Help 0 December 10th 04 01:47 AM


All times are GMT +1. The time now is 02:16 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"