Click here to Skip to main content
Licence CPOL
First Posted 20 Jul 2006
Views 24,141
Downloads 736
Bookmarked 29 times

Creating CSV from SQL Database table attaching it to MS word as datasource and then creating mailmerge document

By | 2 Jul 2008 | Article
Creating CSV from SQL Database table attaching it to MS word as datasource and then creating mailmerge document
 
Part of The SQL Zone sponsored by
See Also

Sample Image - Mailmerge.jpg

Introduction

The code is devided into three parts
1) Creating CSV file
2) Opening CSV file
3) Using CSV file to mailmerge with word document

1) Creating CSV File

CSV file is created from the database table and the file is saved on c: with file name test1.csv.

2) Opening CSV File

This will open the csv file created in step one. It is opened in excel.

3) Mailmerge with word document

For this you will have to first create a word document that will used for merging and save it on c:\ with file name test.doc. The code attach the datasource of test1.csv file to test.doc and also adds field name to word document from datasource.

For using this code you will need to reference of Word and Excel to your project.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Member 3209760



India India

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionAnother DOCX mail merge solution PinmemberJohnny Glenn23:33 13 Mar '12  
Questionmailmerge in wordperfect using vb.net ? PinmemberAJIT KUMAR SUBUDHI20:55 16 May '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 3 Jul 2008
Article Copyright 2006 by Member 3209760
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid