View Single Post
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

Do you happen to have a Next Record field at the end of the document that
becomes LetterDoc?

--
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
wrote in message
oups.com...
Hello all,

I have automated a mail merge using vb.net. Not very easy, but I've
finally got it working with one exception. When the merge executes,
the new merge document that get created a copy of the template document
(minus the fields) is appending to the end of the merged document. I
get the form letter that I want and a copy of the template which I
don't. This happens whether I have the mailmerge print right out
(wesendtoprint) or create a new document (wdprintnewdocument). I can't
figure out what might be causing it.

Following is a portion of my code:

LetterDoc =
DataApp.Documents.Open("G:\imaging\Yooper\Sys\Lett erGen_Letters\ACTLetters\"
& LetterList.SelectedItem, , , , , , , , , , False)

With LetterDoc
.MailMerge.MainDocumentType =
WdMailMergeMainDocType.wdFormLetters
.MailMerge.CreateDataSource(Name:=CurDir() &
"\datadoc.doc", _
HeaderRecord:="last_name,first_name,e_mail,id_numb er")
.MailMerge.EditDataSource()
DataApp.ActiveDocument.Tables.Item(1).Rows.Add()
End With

(I populate the table with relevent data here)

With LetterDoc
With .MailMerge
.Destination =
WdMailMergeDestination.wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
.Execute()
End With
End With

Again, this is working perfectly accept for the copy of the template
which appends to the end of my product. Any idea? Please let me know.