Date switch

G

gyommaui

I am merging datas from Act into Word 2002. The date comes out as 20031126. How do I get it to give me a Friday, November 26, 2003
I think I have tried everything that as recommended on this forum without much success, format never changed
Thanks
 
J

Jay Freedman

gyommaui said:
I am merging datas from Act into Word 2002. The date comes out
as 20031126. How do I get it to give me a Friday, November 26, 2003.
I think I have tried everything that as recommended on this forum
without much success, format never changed.
Thanks

I may be wrong, but I don't think there's any way to get that result
from a field. Assuming all the dates come in as 8-digit numbers (that
is, if the month or day is one digit, it has a leading zero as in
20030507), you can run this macro after the merge to convert the
dates:

Sub ReformatDate()
Dim rgOriginalDate As Range
Dim strTemp As String

Set rgOriginalDate = ActiveDocument.Range
With rgOriginalDate.Find
.ClearFormatting
.Text = "<[0-9]{8}>"
.MatchWildcards = True
.Format = False
.Forward = True
.Wrap = wdFindStop
Do While .Execute
strTemp = rgOriginalDate.Text
strTemp = Mid(strTemp, 5, 2) & "/" & _
Right(strTemp, 2) & "/" & Left(strTemp, 4)
If IsDate(strTemp) Then
rgOriginalDate.Text = _
Format(strTemp, "dddd, MMMM dd, yyyy")
rgOriginalDate.Collapse wdCollapseEnd
End If
Loop
End With
End Sub
 

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