Thread Win32::OLE & Excel
(5 answers)
Opened by gast at 2009-04-28 14:33
Hi!
Kann mir jemand sagen, wie ich im zweiten "Validation"-Beispiel die drop-down-Liste richtig unterbringe? Wie es jetzt ist bekomme ich diese Fehlermeldung: Code: (dl
)
1 Win32::OLE(0.1709) error 0x800a03ec 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 #!C:\Perl\bin\perl.exe use warnings; use strict; use Win32::OLE; 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; my $workbook = $excel -> Workbooks -> Add(); my $sheet = $workbook -> Worksheets( 1 ); $sheet -> Range( 'A1' ) -> {Value} = 'Enter an integer between 1 and 10'; my $range1 = $sheet -> Range( 'B1' ); $range1 -> Validation -> Add( { Type => xlValidateWholeNumber, AlertStyle => xlValidAlertStop, Operator => xlBetween, Formula1 => 1, Formula2 => 10 } ); $sheet -> Range( 'A3' ) -> {Value} = 'Select a value from a drop down list'; my $range2 = $sheet -> Range( 'B3' ); $range2 -> Validation -> Add( { Type => xlValidateList, AlertStyle => xlValidAlertStop, Operator => xlBetween, Formula1 => [ qw( open high close ) ] } ); # macroaufzeichnung : .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= xlBetween, Formula1:="open; high; close" $workbook -> SaveAs( $excelfile ); $workbook -> Close; |