Leser: 15
1 2 3 4 5 6 7 8 9 10 11 12 13 14
foreach my $Tmp ( sort keys %Files ) { my $workbook = Spreadsheet::WriteExcel->new( "Pfad" . "\\" . "tmp-File.xls" ) || die "Error opening "; print STDERR "-Generate $Tmp File...\n"; $workbook->close(); unlink( "Pfad" . "\\" . "$Tmp-File". ".xls" ); my $Excel = Win32::OLE->GetActiveObject('Excel.Application')|| Win32::OLE->new( 'Excel.Application', 'Quit' ); my $workbook2; $workbook2 = $Excel->Workbooks->Open("Pfad" . "\\" . "tmp-File.xls" ); $workbook2->SaveAs("Pfad" . "\\". "$Tmp-File". ".xls" ,xlExcel9795); $workbook2->Close; unlink( "Pfad" . "\\" . "tmp-File.xls" ); print STDERR ".... finished\n"; }
1
2
3
4
5
6
- Generate File1...finished
- Generate File2...
Win32::OLE(0.1709) error 0x800706be: "Der Remoteprozeduraufruf ist
fehlgeschlagen" at PerlScript.pl line 280
eval {...} called at PerlScript.pl line 280
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
my $pfad="Pfad\\"; foreach my $Tmp ( sort keys %Files ) { my $tmpfile="${pfad}tmp-File.xls"; my $outputfile="${pfad}${Tmp}-File.xls"; my $workbook1 = Spreadsheet::WriteExcel->new( $tmpfile ) || die "Error opening "; print STDERR "-Generate $outputfile File...\n"; $workbook1->close(); unlink( $outputfile ) if ( -e $outputfile ); my $Excel = Win32::OLE->GetActiveObject('Excel.Application')|| Win32::OLE->new( 'Excel.Application', 'Quit' ); my $workbook2 = $Excel->Workbooks->Open( $tmpfile ); $workbook2->SaveAs($outputfile ,xlExcel9795); # ^ist das so richtig? $workbook2->Close; unlink( $tmpfile ) or print STRDERR "error unlink $tmpfile\n"; print STDERR ".... finished\n"; }
Guest wer
QuoteÜbrigens deine Beispielausgebe korresponiert nicht mit dem Code.