Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / July 2006

Tip: Looking for answers? Try searching our database.

Automated mail merge of catalog/directory inserts page breaks

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim - 26 Jul 2006 20:46 GMT
I created a Word mail merge document as a "Directory" (what used to be called
a "Catalog"). My data source is a tab-delimited text file. If I open Word and
merge manually, I get the results I expect: multiple records on a single
page. But if I use the ActiveX/.NET interface to run the same merge, I still
get the merged document, but it acts as if the merge was a "Letters" merge
instead of a "Directory" merge. That is, each record appears on its own page.

Here is the Visual Basic 2005 source code that runs the automation. It talks
to Word 2003 via the latest .NET PIA libraries talking through the Office
version 11.x ActiveX features.

<sourceCode>

Dim mergeDoc As Word.Document
Dim msWord As Word.Application
Dim workFile As String = "c:\temp\mergedata.txt"
Dim mergeTemplate As String = "c:\temp\mergecontent.doc"

' ----- Start up a connection to Microsoft Word.
msWord = New Word.Application
mergeDoc = msWord.Documents.Open(mergeTemplate, , True, False)
msWord.Visible = True

' ----- Perform the mail merge.
mergeDoc.MailMerge.OpenDataSource(workFile)
mergeDoc.MailMerge.Destination = _
   Word.WdMailMergeDestination.wdSendToNewDocument
mergeDoc.MailMerge.Execute()

' ----- Finished with the main merge document.
mergeDoc.Close(False)

' ----- Finished.
msWord = Nothing

</sourceCode>
Peter Jamieson - 27 Jul 2006 00:03 GMT
Try setting the type of merge explicitly (i.e. to Directory), e.g. after the
OpenDataSource

Peter Jamieson

>I created a Word mail merge document as a "Directory" (what used to be
>called
[quoted text clipped - 37 lines]
>
> </sourceCode>
Tim - 28 Jul 2006 19:45 GMT
Yes, that solves the problem. Thank you.

> Try setting the type of merge explicitly (i.e. to Directory), e.g. after the
> OpenDataSource
>
> Peter Jamieson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.