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 / August 2005

Tip: Looking for answers? Try searching our database.

template appending to merged document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bidalah@yahoo.com - 05 Aug 2005 23:23 GMT
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\LetterGen_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_number")
           .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.
Doug Robbins - 06 Aug 2005 06:46 GMT
Do you happen to have a Next Record field at the end of the document that
becomes LetterDoc?

Signature

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

> Hello all,
>
[quoted text clipped - 39 lines]
> 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.
bidalah@yahoo.com - 09 Aug 2005 17:20 GMT
Hi Doug. Thanks for the response.  I did not have a next record field
in my template letter.  I did however have a blank row in the data
document (datadoc)!  That was the problem.  Mailmerge was working
perfectly, merging the row of data that I wanted and the blank fields
of the extra row.  

Thanks again for your help.

Rate this thread:






 
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.