Hi Everybody
I am trying to print a word document, and i found this code (https://blogs.msdn.microsoft.com/czdaxsup/2009/09/08/howto-print-word-document-from-x/) which works fine. But i also need to specify a specific printer, it is using the default printer. Can anybody help?
I read something about using the method ActivePrinter to set the printer, but it does'nt seem to work. I get the error Method not exist.
I am using Word 2016.
----------------------------------------
str document = "C:\\test.doc";
COM wordApplication;
COM wordDocuments;
COM wordDoc;
str printerName = "\\\\H\\MyPrinter";
;
// Create instance of Word application
wordApplication = new COM("Word.Application");
// Get documents property
wordDocuments = wordApplication.Documents();
// Open document
wordDoc = wordDocuments.Open(document);
// Activate the document - this is necessary to print it
wordDoc.Activate();
// Print the document
wordDoc.PrintOut();
// Close document
wordDoc.Close();
// Close Word application
wordApplication.Quit();