Click here to Skip to main content
Click here to Skip to main content

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

, 2 Jul 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

Comments and Discussions

 
QuestionAnother DOCX mail merge solution PinmemberJohnny Glenn13-Mar-12 23:33 
Questionmailmerge in wordperfect using vb.net ? PinmemberAJIT KUMAR SUBUDHI16-May-08 20:55 

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.

| Advertise | Privacy | Mobile
Web01 | 2.8.141015.1 | Last Updated 3 Jul 2008
Article Copyright 2006 by Member 3209760
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid