By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Perform Mail Merge - Stuck Up and Need Help

P: 13
Hi,

I am not that experienced in VB.NET. I am working on a application where i have to perform mail merge from the application. The application lets the userwrite letters, save them as rtf file. In letter, tags are added programmatically for fields to add data while merging. User can use the letter later to perform mail merge on it to selected customers. Customers dataset is ready.

Now, can any one assist me how to move further to perform the mail merge stuff. Till now, I have a letter with tags in it like <<CompanyName>>, etc and a dataset with list of records. I have started off with the code ;

Expand|Select|Wrap|Line Numbers
  1.     Private Sub PerformMailMerge()
  2.         Dim wApp As New Word.Application
  3.         Dim wDoc As Word.Document
  4.         Dim wMailMerge As Word.MailMerge
  5.  
  6.         wDoc = wApp.Documents.Open(Me.CapFileName)
  7.         wApp.Visible = True
  8.         wDoc.Unprotect()
  9.  
  10.         wDoc.MailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument
  11.         wDoc.MailMerge.Execute()
I want to know how to add data for each record in the dataset and how will this mail merge work out.

Any help is appreciated. Please.

Thanks
Sep 3 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.