attempting to open a word 2010 doc and start mail merge process
having trouble with MailMerge.OpenDataSource
i need the users to select the criteria then run the merge from a windows form
i have tried many ways , the closest is by following code:
string SQLConn1 = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=warehousing;Data Source=dct-kwy-sosql1;";Object oMissing = System.Reflection.Missing.Value;
Object oTrue = true;
Object oFalse = false;
Word.Application oWord = new Word.Application();
Word.Document oWordDoc = new Word.Document();
oWord.Visible = true;
Object oTemplatePath = path;
oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);
oWordDoc.MailMerge.MainDocumentType = Word.WdMailMergeMainDocType.wdFormLetters;
Connection:SQLConn1,SQLStatement:"SELECT * FROM vwRenewalLetters");
oWordDoc.MailMerge.Destination = Microsoft.Office.Interop.Word.WdMailMergeDestination.wdSendToNewDocument;
oWordDoc.MailMerge.Execute();
the doc opens with the following dialog
when i click ok Visual studio shows error:
any thoughts?
Grant