I'm trying to print a range of pages from objeto
co_de OleObject
to ("word.application")
and I'm not getting it.
Using delphi 6
I can print successfully, but I want to print a range of pages.
Thank you very much for the help.
Code:
if (OpenDialog1.Execute) then
begin
try
// Cria objeto principal de controle do Word
WinWord := CreateOleObject('Word.Application');
if (not (VarIsEmpty(WinWord))) then
begin
// Mostra o Word
try
WinWord.Visible := false;
Docs := WinWord.Documents;
// Abre um documento
Doc := Docs.Open(OpenDialog1.FileName);
//Doc.PrintOut(false);
//Doc.PrintOut(Copies := 2);
Doc.PrintOut(Background := false, Append := false, Range := wdPrintFromTo, OutputFileName := EmptyParam, From := 1, To := 2);
// erro apresentado: "tipo não correspondente"
finally
// Fecha o Word
//WinWord.close;
//Doc.Close(SaveChanges := 0);
WinWord.ActiveDocument.Close(SaveChanges := 0);
WinWord.Quit;
WinWord := Unassigned;
Docs := Unassigned;
Doc := Unassigned;
end;
end;
//showmessage('Fim!');
finally
end;
end;