Personalized Community is here!
Quickly customize your community to find the content you seek.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
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";
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
// Print the document
// Close document
// Close Word application
You can either change Application's ActivePrinter property or - if you don't want to change the default printer - call WordBasic.FilePrintSetup().
When i try to use active printer i get this error message
And when i try to use FilePrintSetup i get this message
My code is
// Or i tried this
wordDoc = wordDocuments.Open(_filename);
In the first case, you'll have to find out what kind of "printer error" it is. First of all, make sure that the printer name is correct and the printer is available.
In the latter case, you're trying to call the method on a wrong object (Application instead of WordBasic).
Thanks Martin. It worked, the name were missing the prefix for print server.
Business Applications communities