.NET/Word 2003 Mail Merge Problem

D

Dan Marth

I am trying to do a mail merge using C#.NET, Word 2003 and the code from
this http://www.codeproject.com/KB/cs/C__Word_2003_Mailmerg.aspx
article.................any help would be greatly appreciated!

This is the error I receive, "Word was unable to open the data source." I
have checked the username and password over and over and it works fine
outside the below code. Any ideas why I might be getting this error?

Object oConnection = "DSN=My_DSN;Uid=UserName;Pwd=Password;"; //The DSN
connection name

Object oQuery = "SELECT * FROM Fax_Data"; // The query to get data from the
DSN

Object oSubType = Word.WdMergeSubType.wdMergeSubTypeWord;

//Open the data source and merge the fields

wrdMailMerge.OpenDataSource("", ref oFileFormat, ref oMissing, ref oMissing,
ref oTrue, ref oMissing, ref oMissing, ref oMissing, ref oFalse, ref
oMissing, ref oMissing, ref oConnection, ref oQuery, ref oMissing, ref
oMissing, ref oSubType);
 

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