Title: Message
Hi,
I can't seem to figure out why it is giving me this error
 Can't call method "Cells" on unblessed reference at c:\inetpub\wwwroot\trialmap\cgi-bin\hmtEvalUP.pl line 1334.
 
$Worksheet1->Cells is not causing any problems.  Any help would be appreciated.
Thanks,
David
 
my $Class = "Excel.Application";
 $Excel = Win32::OLE->GetActiveObject($Class);
 if ( ! $Excel )
 {
  $Excel = new Win32::OLE( $Class )
   || die "Could not create an OLE '$Class' object";
 }
 $Excel->{DisplayAlerts}=0; 
 my $Workbook = $Excel->Workbooks->Add();
 my $Worksheet1 = $Workbook->Worksheets(1);
 $Worksheet1->{Name} = "info.";
 # get the column headers from each table in the db.
 my ($colInfo, $colData, $colResults) = &getColNames();
 $row = 1;
 $col = 1;
 # add column headers for sheet 1
 my @colI = @{$colInfo};
 my $num = @colI;
 for ($i=0; $i<$num - 1; $i++)
 {
  $Worksheet1->Cells($row,$col)->{Value} = $colI[$i];
    $col++;
   }
   my $numCols = $col;
   # Add some formatting
   for ($i=1; $i<$numCols; $i++)
   {
    $Worksheet1->Cells($row,$i)->Font->{Bold} = "True";
  $Worksheet1->Cells($row,$i)->Font->{Size} = 12;
 }
 # add column headers for sheet 2
 my $Worksheet2 = $Workbook->Worksheets(2); 
 $Worksheet2->{Name} = "Data & Results";
 $col = 1;
 foreach $c (@{$colData})
 {
  $Worksheet2->Cells($row,$col)->{Value} = $c;    ######### 1334 ##########
  $col++;
 }

Reply via email to