COM

From: Date: Fri, 11 Jan 2002 08:11:38 +0000
Subject: COM
Groups: php.general 
Request: Send a blank email to php-general+get-80172@lists.php.net to get a copy of this message
Hi everybody, When i run the following script in a dos box it works fine. If i run it in a browser window i receive a Dr Watson. Anybody has an idea ? My config is Apache 1.3.20 PHP 4.0.5 Windows NT4 SP5 French The script is inspired of the following url http://www.phpbuilder.net/columns/alain20001003.php3 <? $workbook = "D:\CAC40.XLS"; $sheet = "Feuil1"; #Instantiate the spreadsheet component. $ex = new COM("Excel.application") or Die ("Did not connect"); #Open the workbook that we want to use. $wkb = $ex->application->Workbooks->Open($workbook,3) or Die ("Did not open"); $sheets = $wkb->Worksheets($sheet); #Select the sheet $sheets->Calculate; $sheets->activate; #Activate it $cell = $sheets->Cells(2,2) ; #Select the cell (Row Column number) $cell->activate; #Activate the cell $oldcell=$cell->value; print "Cac40 = {$cell->value} <BR>"; #Print the value of the cell:10000 $cell = $sheets->Cells(1,2) ; #Select the cell (Row Column number) $cell->activate; #Activate the cell $oldcell=$cell->value; print "DowJones = {$cell->value} <BR>"; #Print the value of the cell:10000 #Close all workbooks without questioning $ex->application->ActiveWorkbook->Close(False); unset ($ex); ?>

« previous php.general (#80172) next »