#!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;