MS Excel Error in CGI

Asked By 50 points N/A Posted on -
qa-featured

Hello TechyV buddies!

I am having some issue on MS Excel. I am suing MS Excel’s data analysis tool to deal with some data on excel. Because of this I have used the following:

$excel->AddIns->Add( "$xll_path" );

$excel->RegisterXLL( 'Analys32.xll' );

However, when I try to do this: 'C:UsersLF>perl test_1.pl' And error appears when I try to open CGI via IE. ERROR INFO:

[Mon Jun 04 22:32:02 2012] [error] [client 127.0.0.1] in METHOD/PROPERTYGET "SaveAs" at C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/qynjjjyjpjhsgj.cgi line 1372, referer: https://www.techyv.com/cgi-bin/qynjjjyjpjhsgj.cgi [Mon Jun 04 22:33:59 2012] [error] [client 127.0.0.1] Premature end of script headers: qynjjjyjpjhsgj.cgi, referer: https://www.techyv.com/cgi-bin/qynjjjyjpjhsgj.cgi [Mon Jun 04 22:33:59 2012] [error] [client 127.0.0.1] OLE exception from "Microsoft Office Excel":, referer: https://www.techyv.com/cgi-bin/qynjjjyjpjhsgj.cgi [Mon Jun 04 22:33:59 2012] [error] [client 127.0.0.1] , referer: https://www.techyv.com/cgi-bin/qynjjjyjpjhsgj.cgi [Mon Jun 04 22:33:59 2012] [error] [client 127.0.0.1] xb2xbbxc4xdcxc8xa1xb5xc3xc0xe0 AddIns xb5xc4 Add xcaxf4xd0xd4, referer: https://www.techyv.com/cgi-bin/qynjjjyjpjhsgj.cgi [Mon Jun 04 22:33:59 2012] [error] [client 127.0.0.1] , referer: https://www.techyv.com/cgi-bin/qynjjjyjpjhsgj.cgi [Mon Jun 04 22:33:59 2012] [error] [client 127.0.0.1] Win32::OLE(0.1709) error 0x800a03ec, referer: https://www.techyv.com/cgi-bin/qynjjjyjpjhsgj.cgi [Mon Jun 04 22:33:59 2012] [error] [client 127.0.0.1] in METHOD/PROPERTYGET "Add" at C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/qynjjjyjpjhsgj.cgi line 1427, referer: https://www.techyv.com/cgi-bin/qynjjjyjpjhsgj.cgi

Here are the system logs:

The code:

sub calc_all_14 {

my $lib_root = catfile( $ENV{ProgramFiles}, 'Microsoft Office', qw(OFFICE12 Library Analysis) );

#print "1—$lib_rootn";

my $xll_path = catfile $lib_root, 'ANALYS32.XLL'; #print "2—$xll_pathn";

my $xla_path = catfile $lib_root, 'ATPVBAEN.XLAM'; #print "3—$xla_pathn";

my $excel = get_excel();

#$excel->{Visible} = 1;

#sleep(5);

my $book = $excel->Workbooks->Open($JSGCB_13); $book->RunAutoMacros(1);

my $sheet = $book->Worksheets(1);

# count the data line num

my $flag_counter = -1;

my $row = 5;

# for calc the line num

while ($flag_counter ne '0') {

$flag_counter = 0;

# check column 1 for the existing line

if (defined $sheet->Cells($row,1)->{'Value'}) { $flag_counter ++;

} else {

last;

}

$row ++;

}

my $row_num = $row – 1;

my $str_1_1 = '$AQ$5:$AQ$'.$row_num;

my $str_1_2 = '$AU$5:$AV$'.$row_num;

my $str_2_1 = '$AQ$5:$AQ$'.$row_num;

my $str_2_2 = '$AS$5:$AT$'.$row_num;

my $str_3_1 = '$AQ$5:$AQ$'.$row_num;

my $str_3_2 = '$AR$5:$AS$'.$row_num;

$excel->AddIns->Add( "$xll_path" );

$excel->RegisterXLL( 'Analys32.xll' );

my $atp_book = $excel->Workbooks->Open( $xla_path ); $atp_book->RunAutoMacros(1);

$sheet = $book->Worksheets(1);

#sleep(5);

# Application.Run "ATPVBAEN.XLA!Regress", ActiveSheet.Range(Cells(2, 2), Cells(i, 2)), ActiveSheet.Range(Cells(2, 3), Cells(i, j)), False, False, , ActiveSheet.Range("$H$26"), False, False, False, False, , False

# for C-L

$excel->Run(qq{ATPVBAEN.XLAM!Regress},

$sheet->Range($str_1_1),

$sheet->Range($str_1_2),

0,0,95,'C-L',1,1,1,1,1,1);

# for H-M

$excel->Run(qq{ATPVBAEN.XLAM!Regress},

$sheet->Range($str_2_1),

$sheet->Range($str_2_2),

0,0,95,'H-M',1,1,1,1,1,1);

# for T-M

$excel->Run(qq{ATPVBAEN.XLAM!Regress},

$sheet->Range($str_3_1),

$sheet->Range($str_3_2),

0,0,95,'T-M',1,1,1,1,1,1);

$excel->{DisplayAlerts} = 0;

if (-e $JSGCB_14) {

unlink $JSGCB_14;

}

#sleep(5);

# save and exit

$book->SaveAs($JSGCB_14);

$book->close;

undef $book;

undef $excel;

#system ('cmd');

#exec 'cmd';

}

Can anyone help me solve this issue? I really need help here guys. Thank you!

SHARE
Answered By 10 points N/A #146778

MS Excel Error in CGI

qa-featured

Hello Minty,

Have tried restarting MS Excel already, because the error you are getting could be due to a temporary problem that could be resolved when the application is restarted. Some other remedies you will need to try are the following:

  • Try uninstalling the MS Excel data analysis tool by going to the control panel and then programs and features, and then removes it under the Add/Remove programs.
  • You may want to first of all install CCleaner on your system and then run it to remove all registry entry related errors, for there may be some broken registry entries on your computer that are causing the application to malfunction.

Hope this helps.

Regards,

Carl

 

Related Questions