Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / February 2005

Tip: Looking for answers? Try searching our database.

Mail Merge with C# and Word 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tpark - 02 Feb 2005 21:58 GMT
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
Doug Robbins - 02 Feb 2005 23:39 GMT
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

Signature

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

>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
[quoted text clipped - 14 lines]
> Thank you,
> Todd
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.