Page 1 of 1

For help!Why this has errors about excel???

Posted: Thu Jun 05, 2003 4:47 am
by mike.zhu
:(
the code is :

Code: Select all

$exapp = new COM("Excel.application");
$exapp->SheetsInNewWorkbook = 1;
$exapp->Application->Visible = 1;
$exapp->DisplayAlerts = True;
$wkb=$exapp->Workbooks->add();
$sheets = $wkb->Worksheets(1);
$sheets->activate;
$sheets->name = "hello";

for ($i=0; $i < 100; $i++)
{
	for ($j=0; $j < 10; $j++)
	{
		$a = chr(65 + $j);	
		$ran = $sheets->Range($a.$i);
		$ran->value = $i;
	}
}

$exapp->Quit();
mod_edit: added

Code: Select all

tags[/size]
 
and the errores are:
1.can't written in memory address,the address XXXXXXXXX is read ,can't be write.but i succes make a new excel file.
2.this code: header("Location:",$file_name);it doesn't work.

P.S:My enviorment:
Windows 2000 Professional,Apache 2.0.45,PHP 4.0.13

Thanks a lot.

Posted: Thu Jun 05, 2003 4:49 am
by []InTeR[]
2.this code: header("Location:",$file_name);it doesn't work.

must be
header("Location: ".$file_name);

Posted: Thu Jun 05, 2003 8:51 pm
by mike.zhu
sorry,i make a mistake when i post it.
it realy is header("Location:".$file_name".)";

It is so strange that sometimes it will work,but sometimes it won't work?

I think it is the bug of PHP or Apache.Because use ASP/VBA,it work good.

Posted: Thu Jun 19, 2003 10:09 pm
by toshesh
what does this code do? can it read excel files?