Hello People,
I'm trying to use OLE with MS Excel, I'm able to open a file set to a wanted
value some cells and then print out on a pdf file, but I'm not able to
set up the page characteristic. The following code works except the numbered
lines, if I run the scrip with -w option i get the message
"Win32::OLE(0.15) error 0x80020006: "Unknown name" "PrintArea" in
GetIDsOfNames for "PageSetup" at excelprocess.pl line 37", for line (1) and
similar for line (2).

May anybody explain what is wrong and how can I do?

THANKS A LOT

use CGI qw(:standard);
use Time::localtime;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Excel';

$OffsetFirstJan=3;
$OffsetCentem=8;

$ExcelApps = Win32::OLE->new('Excel.Application', 'Quit');
$ExcelApps->{'Visible'} = 0;
$ExcelBook =
$ExcelApps->Workbooks->Open("f:\\Sito_intranet\\Holidayplan\\holiday_plan_2002.xls");
$ExcelSheet = $ExcelBook->Worksheets(1);

$Cell1=&NumToChar( ($OffsetFirstJan+10) ).$OffsetCentem;
$Cell2=&NumToChar( ($OffsetFirstJan+20) ).$OffsetCentem;

$Range = $ExcelSheet->Range("$Cell1:$Cell2");
$Range->{Value} =[[X,X,x,x,x,l,l,l,l,l]];


(1) $ExcelSheet->PageSetup( {PrintArea=>("A1:D8")} );
(2) $ExcelSheet->PageSetup( {LeftHeader=>pippo, CenterHeader=>pippo,
    RightHeader=>pippo, LeftFooter=>pippo, CenterFooter=>pippo,
    RightFooter=>pippo, LeftMargin=>0, RightMargin=>0, TopMargin=>0,
    BottomMargin=>0, HeaderMargin=>0, FooterMargin=>0, PrintHeadings=>False,
    PrintGridlines=>True, PrintComments=>xlPrintNoComments, PrintQuality=>600,
    CenterHorizontally=>True, CenterVertically=>True, Orientation=>xlLandscape,
    Draft=>0, PaperSize=>xlPaperA4, FirstPageNumber=>xlAutomatic,
    Order=>xlDownThenOver, BlackAndWhite=>1, Zoom=>2, FitToPagesWide=>1,
    FitToPagesTall=>1} );

$ExcelSheet->PrintOut( {Copies=>1, ActivePrinter=>"Acrobat PDFWriter on LPT1:",
PrToFileName=>"f:\\temp\\ciccio"} );

$ExcelBook->Save;
$ExcelBook->Close;



-- 
************************************************************
Eng. MARCO CENTEMERI

 Telecommunication and Peripherals/Automotive Groups
 Audio & Automotive Division
 Automotive Business Unit
 Bosch Product Engineer

STMicroelectronics Srl             Tel: +39.039.603.5784
20041 Agrate Brianza - Italy       Fax: +39.039.603.6343
Via C. Olivetti, 2                 Mobile: +39.348.8861577
Building F11                       [EMAIL PROTECTED]
************************************************************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to