i open a MS Word document using the following code:
try
{ Open the document}
WrdApp := CreateOLEObject('Word.Application');
wrdDoc := 'temp.docx');
// Wrddoc.SaveAs('temp2.docx');
except
on E: Exception do
begin
E.Message := 'Could Not Execute MS WORD!';
raise;
end;
end;
And print it using wrdapp.Printout
I have a combobox that has a list of printer names from the computer using the code:
Combobox32.Items.Assign(Printer.Printers);
How do i change the active printer in MS Word to the selected printer in the combobox, so that when i call wrdapp.Printout
it will print from the printer selected in the combobox?
thank you in advance for your help.
You can simply assing WrdApp.ActivePrinter with the name of the printer you want to use. In your case, you picjk it from the item selected in the combobox. For a code example, see this: http://francois-piette.blogspot.be/2014/02/automate-word-document-print-using.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.