Adding Data Source File Name to Word 2007 Merge

L

lee

I am trying to add the file name for my data source to the bottom of my Word
2007 merge document & cannot find information on how to include. Any
suggestions?
 
D

Doug Robbins - Word MVP

You would need to run a macro containing the following code AFTER attaching
the data source to the mail merge main document:

With ActiveDocument
.Sections(1).Footers(wdHeaderFooterPrimary).Range.InsertAfter
..MailMerge.datasource.Name
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

macropod

Hi Lee,

An alternative approximation would be to use a DDE field to your main mailmerge document, coded along the lines of:
{IF{MERGESEQ}> 0 { dde excel system selection }}
This will return the filename and the last field position from the file, in the form of:
'[MailMergeData.xls]Sheet1'!R150C3
 

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