Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

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

0.00/5 (No votes)
3 Jul 2008 1  
Creating CSV from SQL Database table attaching it to MS word as datasource and then creating mailmerge document

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here