Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tim Tim is offline
external usenet poster
 
Posts: 2
Default Automated mail merge of catalog/directory inserts page breaks

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


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Automated mail merge of catalog/directory inserts page breaks

Try setting the type of merge explicitly (i.e. to Directory), e.g. after the
OpenDataSource

Peter Jamieson

"Tim" wrote in message
...
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




  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Tim Tim is offline
external usenet poster
 
Posts: 2
Default Automated mail merge of catalog/directory inserts page breaks

Yes, that solves the problem. Thank you.

"Peter Jamieson" wrote:

Try setting the type of merge explicitly (i.e. to Directory), e.g. after the
OpenDataSource

Peter Jamieson


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I mail merge to EMAIL from MS Word AND add a pdf attachment Lily@Insight Mailmerge 24 January 15th 07 10:33 PM
30 page mail merge labels only prints one page? Kuda Mailmerge 1 February 9th 06 06:08 AM
How do I print 1 page of a mail merge? Elleen Mailmerge 1 December 28th 05 04:14 PM
Why do I get an extra page when I mail merge a word document? olddog618 Mailmerge 1 December 16th 05 07:08 PM
section breaks change each time opening document Dave Microsoft Word Help 6 March 21st 05 12:01 PM


All times are GMT +1. The time now is 08:36 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"