此行出现错误
my $Sheet = $workbook5->Worksheets($d);
like无法在at的未定义值上调用方法工作表。 但是它只是随机出现,而不是所有时间。 请帮忙。
SQC_Module::xl_color_fill($actuall_excel,$d+1,\@more_col,\@more_rows);
sub xl_color_fill {
my ($FileName,$d,$more_col,$more_rows)=@_;
my @more_col = @{ $more_col };
my @more_rows = @{ $more_rows };
#print "$#more_rows\n";
#print "$#more_col\n";
my $excel5 = new Win32::OLE('Excel.Application');
my $workbook5 = $excel5->Workbooks->Open($FileName);
my $Sheet = $workbook5->Worksheets($d);
my $num=0;
for (my $i=0;$i<$#more_rows+1;$i++) {
my $clr_row=$more_rows[$num];
my $clr_col=$more_col[$num];
$clr_row++;
$clr_col++;
#print "clr_row :: $i, $clr_col , $clr_row";
$Sheet->Cells($clr_row,$clr_col)->{Interior}->{ColorIndex} = 3;
$num++;
}
#print "Coloring over\n";
$workbook5->Save();
$excel5->ActiveWorkbook->Close(0);
$excel5->Quit();
}