RE: [PHP-WIN] Closing Excel using DCOM and Release()
| From: | jeff dot waldock at blueyonder dot co dot uk | Date: | Tue, 11 Sep 2001 07:29:55 +0000 |
| Subject: | RE: [PHP-WIN] Closing Excel using DCOM and Release() | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-9312@lists.php.net to get a copy of this message | ||
Thanks again - I've looked at your class as suggested (this was where I got the original
example from!)
Unfortunately I still seem to get the same problem - the instance of Excel will not close on exit.
The code reads the data in cell 11,5 of the Excel file fine - it's ALL OK, I just can't
get the Quit function to release the app!
Have you any idea why this happens and how I can fix it? I've tried on several different
machines with the same result.
Here is the code I've used ..
<?php
echo "
<HTML><HEAD><TITLE>Processing Form</TITLE></HEAD><BODY
BGCOLOR=\"#D5D5AB\">
<h1>This is a test</h1>";
$xlApp = new COM("Excel.Application") or Die ("Did not connect");
$workbook = 'e:\wwwroot\temp\xxx.xls';
$wkb = $xlApp->Workbooks->Open($workbook) or Die ("Did not open");
$sheets = $wkb->Worksheets("Sheet1");
$cell = $sheets->Cells(11,5);
print "Cell Value = {$cell->value} <BR>";
$xlApp->ActiveWorkbook->Close("False");
$xlApp->Quit;
$xlApp = null;
echo "</body></html>";
?>
----Original Message-----
From: "Alain Samoun" <alain@sonic.net>
Sent: 10 September 2001 22:36
To: "Jeff Waldock" <jeff@waldock.org>
Cc: "php-windows@lists.php.net" <php-windows@lists.php.net>
Subject: Re: [PHP-WIN] Closing Excel using DCOM and Release()
Well, to close your Excel App, you will use:
xlApp->quit;
Talk about consistency from M$ ;)
For Excel, you may want to have a look at my class:
http://www.phpbuilder.com/columns/alain20001003.php3
It's becoming old now, but still has some value I guess.
Alain