this slowpoke moves

Print Excel Document

uses ExtCtrls, ComObj, Excel2000

//

procedure TForm1.Button1Click(Sender: TObject);
var
  ExcelApp: OLEVariant;
begin
  // Create an Excel instance
  ExcelApp := CreateOleObject('Excel.Application');
  try
    ExcelApp.Workbooks.Open('C:\test\xyz.xls');
    // you can also modify some settings from PageSetup
    ExcelApp.ActiveSheet.PageSetup.Orientation := xlLandscape;
    // Print it out
    ExcelApp.Worksheets.PrintOut;
  finally
    // Close Excel
    if not VarIsEmpty(ExcelApp) then
    begin
      ExcelApp.Quit;
      ExcelApp := Unassigned;
    end;
  end;
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate