Title: Message
Hi,
I'm getting this error message when I run my application.  "Can't use an undefined value as a HASH reference at c:\inetpub\wwwroot\trialmap\cgi-bin\standardQ.pl line 738".
The strange part is that it gives me this message the first time when I run it.  Then if I run it again, it executes fine.  But run it again, it gives the same error.  So, it's executing successfully on every other execution.  Here is the code, it is choking when I rename my Excel sheet name.
I can't figure it out.
Thanks,
David
 
use Win32::OLE;
 
 unlink($path) if (-e $path);
 my $Class = "Excel.Application";
 # Create a new workbook and add a worksheet
 my $Excel = Win32::OLE->GetActiveObject($Class);
 if ( ! $Excel )
 {
     $Excel = new Win32::OLE( $Class)
      || die "Could not create an OLE '$Class' object";
 }
 my $Workbook = $Excel->Workbooks->Add();
 $Excel->{SheetsInNewWorkbook} = 7;
 $Excel->{DisplayAlerts}=0;
 my @sheetName = ("QvData", "QvSummary", "PidcData", "PidcSummary", "ScnrDscp", "SampleSummary", "FileSummary");
 my $numSheets = 7;
 $scnr = &getScannerName($scannerDes);
 for ($i=0; $i<$numSheets; $i++)
 {
      my $sheet = $sheetName[($numSheets - $i - 1)];
      my $Worksheet  = $Workbook->Worksheets($numSheets - $i);
      # name worksheets
      $Workbook->Worksheets($numSheets - $i)->{Name} = "$sheet";  #### error here
      # write header row to excel
      for ($j=1; $j<$numCol; $j++)
      { 
         my $Cell = $Worksheet->Cells($row, $col);
         $Cell->{Value} = $cols[$j];
         $col++;
      }
...

Reply via email to