Thread Win32::OLE & Excel
(5 answers)
Opened by gast at 2009-04-28 14:33
Was stimmt hier nicht?
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 #!/usr/bin/perl use warnings; use strict; use Win32::OLE qw( in with ); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; my $excelfile = 'test.xls'; my $excel = Win32::OLE -> GetActiveObject( 'Excel.Application' ) || Win32::OLE -> new( 'Excel.Application', 'Quit' ); $excel -> {DisplayAlerts} = 0; $excel -> {Visible} = 0; $excel -> {SheetsInNewWorkBook} = 1; my $workbook = $excel -> Workbooks -> Add(); my $sheet = $workbook -> Worksheets( 1 ); $sheet -> Activate; $sheet -> {Name} = 'Tabelle_Eins'; $sheet -> Range( 'A1' ) -> {Value} = 5; $sheet -> Range( 'A2' ) -> {Value} = '=IF(A5>3, "Yes", "No")'; $workbook -> SaveAs( { Filename => $excelfile, FileFormat => xlWorkbookNormal } ); $workbook -> Close; $excel -> Quit; undef $workbook; undef $excel; Ich bekomme diese Fehlermeldung: Code: (dl
)
1 C:\Dokumente und Einstellungen\m\Eigene Dateien>perl win32.pl |