in reply to need program to hang out awhile?
Use Win32::OLE to control Excel and print from within Excel.
I used the code below several years ago to print out an Excel sheet every day. Please note - this code is a snippet and is untested as is.
Hopefully, you can get the idea and adapt to your situation.
use strict; use warnings; use Win32::OLE qw(in with); use Win32::OLE::Variant; use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; my $excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', + 'Quit'); my $book = $excel->Workbooks->Open("I:\\Path\\To\\File\\file +.xls"); my $sheet = $excel->Worksheets(1); #Sub PrintOut([From], [To], [Copies], [Preview], [ActivePrinter], [Pri +ntToFile], [Collate]) $sheet->PrintOut(1,1,1,0,"HP LaserJet IIIP",0,0); $book->Save; $book->Close; print "Done\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: need program to hang out awhile?
by cypress (Beadle) on Dec 03, 2009 at 14:22 UTC | |
by Jenda (Abbot) on Dec 03, 2009 at 23:33 UTC |