I've been trying to print out a some pages from a word document created from a template. I use the Word.Printout() method, but I just can't figure out how to use the Word.PrintOut(From: X, To: X). I just can't seem to get it right. Can any body help me? :-)
Object oMissing = System.Reflection.Missing.Value;
Object oTemplatePath = @"C\batch_template.dotx";
Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
Document wordDoc = new Document();
wordDoc = wordApp.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);
Object myFrom = "1";
Object myTo = "5";
wordDoc.SaveAs("myFile.doc");
wordDoc.Range(myFrom, myTo);
wordApp.Documents.Open("myFile.doc");
wordApp.PrintOut();
Thanks!
wordDoc.PrintOut(Range: WdPrintOutRange.wdPrintFromTo, From: myFrom, To: myTo)
) – Corak Jun 3 at 9:21Object myFrom = "1"; Object myTo = "5"; wordDoc.SaveAs("myFile.doc"); wordApp.Documents.Open("myFile.doc"); wordApp.PrintOut(Range: WdPrintOutRange.wdPrintFromTo, From: myFrom, To: myTo);
THANKS! – Asger Jun 3 at 9:49