... $file = "C:\\testw.txt"; open (TTT, ">$file") || die "error"; $filename = "C:\\temp\\frufru.xls"; $filter = 'gif'; # can be GIF, JPG, JPEG or PNG $pngnm = "C:\\test"; eval{ my $Excel = Win32::OLE->new('Excel.Application', 'Quit'); # use the Excel application if it's open, otherwise open new #why in the hell would you want to do this? #$hwnd = $Excel->{"Hwnd"}; #Hell no print TTT $hwnd; die "Cannot find $filename" unless (-e $filename); my $Book = $Excel->Workbooks->Open( $filename ); # open the file foreach my $Sheet (in $Book->Sheets) { ... #### #$hwnd = $Excel->{"Hwnd"};