Merging dates to hard text

L

Lynne

Hi,

I am using mail merge and the 'Date' field. Is there anyway to make the
'Date' field fixed after the merge? I want the date of the merged document
to stay fixed when it is reopened. The 'Date' field updates to the current
date if the document is repoened. The 'SaveDate' and 'CreateDate' seem to use
the date of the template containing the mergefields not the actual merged
document.

Thanks
Lynne
 
G

Graham Mayor

As you report CreateDate shows the date of creation of the merge document
but merges to plain text. The simplest solution is to use SaveAs to save the
merge document with the same name then update the field. You can do this
with a few lines of macro code.

Dim fName As String
With ActiveDocument
fName = .FullName
.SaveAs fName
.Fields.Update
End With

http://www.gmayor.com/installing_macro.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
P

Peter Jamieson

If it's just for you, you can try this if you like - the basis of it is
described in http://tips.pjmsn.me.uk/t0004.htm although some of the
techniques described in there no longer seem to work in Word 2007, and it
will only work if the ODBC text driver is present on your system (you'll
find out quite quickly if that is the case)

1. Create a folder called c:\i

2. Create a plain text file, e.g. using Notepad and put the following text
in it:

[ODBC]
DRIVER=Microsoft Text Driver (*.txt; *.csv)
FIL=text
DriverId=27
DefaultDir=C:\i

3. Save the file as c:\i\i.dsn (its probably easier to save it as c:i\i.txt
then rename it)

4. Put the following field in your document:

{ DATABASE \d "c:\\i\\i.dsn" \c "FILEDSN=c:\\i\\i.dsn" \s "SELECT date()"
\@"DD/MM/YYYY" }

The {} need to be the special field codes that you can insert using ctrl-F9.
You need a \@ date format "switch" or Word may insert an extra paragraph
mark, but specify the date format you need.

5. Select the field and press F9 to update it. If you see today's date,
you're in business.

6. Test a merge to a new document. The DATABASE field should be replaced by
the date of the merge. I'd make sure you can do the real merges you need
before committing to this approach.

(Once you have done steps 1 to 3 you shouldn't have to do them again. You
can save the DATABASE field as an AutoText (or Quick Part in Word 2007)
 

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