<?xml version="1.0" encoding="windows-1252"?>
<node id="810793" title="Re: need program to hang out awhile?" created="2009-12-03 05:01:40" updated="2009-12-03 05:01:40">
<type id="11">
note</type>
<author id="62157">
tokpela</author>
<data>
<field name="doctext">
&lt;p&gt;
Use &lt;a href="http://search.cpan.org/search?query=Win32%3A%3AOLE&amp;mode=all"&gt;Win32::OLE&lt;/a&gt; to control Excel and print from within Excel.
&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;
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.
&lt;/p&gt;
&lt;p&gt;
Hopefully, you can get the idea and adapt to your situation.
&lt;/p&gt;
&lt;code&gt;
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-&gt;GetActiveObject('Excel.Application') 
                               || Win32::OLE-&gt;new('Excel.Application', 'Quit');

my $book     	  = $excel-&gt;Workbooks-&gt;Open("I:\\Path\\To\\File\\file.xls");

my $sheet         = $excel-&gt;Worksheets(1);

#Sub PrintOut([From], [To], [Copies], [Preview], [ActivePrinter], [PrintToFile], [Collate])
$sheet-&gt;PrintOut(1,1,1,0,"HP LaserJet IIIP",0,0);

$book-&gt;Save;
$book-&gt;Close;
  
print "Done\n";
&lt;/code&gt;

</field>
<field name="root_node">
810644</field>
<field name="parent_node">
810644</field>
</data>
</node>
