Mail Merge with C# and Word 2003

T

tpark

I need to automate a simple mail merge using c# and am having no luck.
I tried the code on MSDN "How to automate Word to perform mail merge
from visual C#" and got all the same errors that everyone else is
getting. i.e Cannot apply indexing with [] to an expression of type
'Word.Tables'

If someone has a solution to this I would appreciate it. If not all I'm
looking for is to simply automate a mail merge using c# from a comma
delimited text file with Word.

I want to hit a button on the application and all it does is grab the
comma delimited text file, walk through the records and do a mail merge
and print each record out accordinly. It doesn't seem like this should
be too hard but I haven't been able to accomplish it.

If anyone has some useful links or sample code please let me know.
Thank you,
Todd
 
D

Doug Robbins

I can't help you with the C# side of it, but if the mailmerge maindocument
was in the form of a template with an autonew macro (VBA) in it to perform
the mailmerge, all you would need to do in C# is get Word to create new
document based on the template.

At some point, you are probably going to need the information in the article
"How to do a mail merge to the printer using VBA, without displaying the
Print dialog" at:

http://word.mvps.org/FAQs/MailMerge/MergeStraightToPrintrWVBA.htm


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top