Datasource File Name

P

Peter Tickler

How do I display the Data Source file name in the header of a mail merge
file?

Is there a Field Code that would do it?
 
P

Peter Jamieson

Is there a Field Code that would do it?

No.

You can get the file name using VBA, e.g.

ActiveDocument.MailMerge.DataSource.Name

and also use VBA to insert it in the header of the mail merge main document
/before/ you merge. A fairly easy way to do this would be to assign the
value to a Custome document property and use a DOCPROPERTY field in the
header of the mail merge main document. If you are using Word 2002 or later
you could consider using a MailMerge event to do this.

(NB, if the data source is not a "file" data source (.txt, .doc, .mdb) but
is (say) an ODBC connection to an SQL Server database, then .Name may be
blank)
 
C

Cindy M -WordMVP-

Hi Peter,
How do I display the Data Source file name in the header of a mail merge
file?

Is there a Field Code that would do it?
No, there's nothing provided directly in Word that can do this for you.
You'd need to use a macro.

Which version of Word are you using, and what data source file type(s)?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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