如何使用delphi xe3更改MS word中的活动打印机

如何使用delphi xe3更改MS word中的活动打印机,delphi,printing,ms-word,Delphi,Printing,Ms Word,我使用以下代码打开MS Word文档: 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!';

我使用以下代码打开MS Word文档:

  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;
并使用
wrdapp.Printout

我有一个组合框,其中包含使用以下代码的计算机打印机名称列表:

Combobox32.Items.Assign(Printer.Printers);
如何将MS Word中的活动打印机更改为组合框中选定的打印机,以便在调用
wrdapp.Printout
时,它将从组合框中选定的打印机打印


提前感谢您的帮助。

您只需在WrdApp.ActivePrinter中输入您要使用的打印机的名称即可。在您的例子中,您可以从组合框中选择的项目中对其进行picjk。
有关代码示例,请参见:

请参见,但请参见此处的备注(它实际上更改了系统默认打印机)。和/或非常好,非常感谢。我以前也尝试过类似的代码,但不断出现错误。我不知道为什么这个有效而另一个无效,但是谢谢