Mydoc.Close(ref oNotTrue, ref oMissing, ref oMissing) Mydoc.SaveAs(ref destination, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing) Mydoc = (ref oFilename, ref oMissing, ref oMissing, ref oMissing) įoreach (Word.MailMergeField myField in ) Row.Add("EmailAddress", reader.GetString(6).ToString()) Row.Add("Company", reader.GetString(5).ToString()) Row.Add("Suffix", reader.GetString(4).ToString()) Row.Add("LastName", reader.GetString(3).ToString()) Row.Add("MiddleName", reader.GetString(2).ToString()) Row.Add("FirstName", reader.GetString(1).ToString()) Row.Add("Title", reader.GetString(0).ToString()) String excelsheets = new string įoreach ( dr in dt.Rows)Įxcelsheets = dr.ToString() įor (int jCount = 0 jCount row = new () OleDbConnection con = new OleDbConnection(constring) ĭt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null) String constring = "Provider=.12.0 Data Source=" + txtBrowse.Text + " Extended Properties=Excel 12.0 Xml" Application myWordApp = new .Application()
Here is the below code i am using : private void GenerateMultipleDocumentAndSendEmail() I am able to create no.of Documents according to DataSource (excel data) and would like to send same document to concerened person emailid (mentioned in excel) but I get this above error.