Group:  Microsoft Word ยป microsoft.public.word.mailmerge.fields
Thread: Merging dates to hard text

Geek News

Merging dates to hard text
Lynne 10/8/2008 6:16:16 AM
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
Re: Merging dates to hard text
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 10/8/2008 6:43:30 AM
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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Lynne wrote:
[Quoted Text]
> 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


Re: Merging dates to hard text
"Peter Jamieson" <pjj[ at ]KillmapSpjjnet.demon.co.uk> 10/8/2008 9:05:25 AM
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()"
\[ at ]"DD/MM/YYYY" }

The {} need to be the special field codes that you can insert using ctrl-F9.
You need a \[ at ] 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)

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Lynne" <Lynne[ at ]discussions.microsoft.com> wrote in message
news:FE8DDA3A-6286-48AF-8E8E-1A1EF845D7BE[ at ]microsoft.com...
[Quoted Text]
> 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

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net