Thread Win32::OLE Windows - Workbooks
(0 answers)
Opened by gast at 2009-05-10 19:59
Hi!
Ist "...->Windows()" und "...->WorkBooks()" das gleiche? 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 #!C:\Perl\bin\perl.exe use warnings; use strict; use Win32::OLE qw( in with ); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; my $excel = Win32::OLE -> GetActiveObject( 'Excel.Application' ) || Win32::OLE -> new( 'Excel.Application', 'Quit' ); $excel -> {DisplayAlerts} = 0; $excel -> {Visible} = 0; $excel -> {SheetsInNewWorkBook} = 3; my $workbook1 = $excel -> Workbooks -> Add(); my $workbook2 = $excel -> Workbooks -> Add(); my $workbook3 = $excel -> Workbooks -> Add(); $excel -> Windows( 2 ) -> Activate; my $sheet = $excel -> ActiveWorkBook -> Worksheets( 2 ); $excel -> ActiveWorkbook -> ActiveSheet -> Cells( 3, 3 ) -> {Value} = 'drei'; $excel -> ActiveWindow -> ActiveSheet -> Cells( 4, 4 ) -> {Value} = 'vier'; $workbook1 -> SaveAs( { Filename => 'test1.xls', FileFormat => xlWorkbookNormal } ); $workbook2 -> SaveAs( { Filename => 'test2.xls', FileFormat => xlWorkbookNormal } ); $workbook3 -> SaveAs( { Filename => 'test3.xls', FileFormat => xlWorkbookNormal } ); $excel -> Workbooks -> Close; $excel -> Quit; |