Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
C# MailMerge from Excel
Hi all,
I am trying to do a mailmerge from a web app in C#. I am trying to use an excel file as a datasource. My code is not running properly. I would appreciate a little help. This is my code: Word.ApplicationClass oWordApp = new Word.ApplicationClass(); object missing = System.Reflection.Missing.Value; object oTemplate = @"c:\test\test.doc"; // some object are not used Object oFalse = false; Object oTrue = true; Object oName = Environment.CurrentDirectory + @"\template.dot"; Object oFileName = Environment.CurrentDirectory + @"\saved.doc"; Object oFileFormat = Word.WdSaveFormat.wdFormatDocument; // end new Word.MailMerge wrdMailMerge; Word.Document oWordDoc = oWordApp.Documents.Add(ref oTemplate,ref missing,ref missing, ref missing); wrdMailMerge = oWordDoc.MailMerge; try { ", ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument; wrdMailMerge.Execute(ref oFalse); // Unload objects from the memory wrdMailMerge = null; oWordDoc = null; oWordApp = null; } catch(Exception e) { Response.Write(e.ToString()); } Thank you, Chris |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I print an Excel Autoshape on a Word doc using mailmerge? | Mailmerge | |||
mailmerge using Word/Excel 500.00 in Excel shows as 500 nt 500.00 | Mailmerge | |||
Excel as mailmerge data source | Mailmerge | |||
excel hangs in mailmerge | Microsoft Word Help | |||
Mailmerge from EXCEL, custom format problem | Mailmerge |