Re: Closing Excel using DCOM and Release()

From: Date: Wed, 12 Sep 2001 22:14:54 +0000
Subject: Re: Closing Excel using DCOM and Release()
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-9336@lists.php.net to get a copy of this message
Here is the address for the excel class: http://phpclasses.upperdesign.com/browse.html?package=86 Look at the functions and example, you have several errors in your script: $workbook should use \\ or / as dir seperator. sheet1 is the default name, use something else for a new sheet. Also: Delete all the excel processes, if any,from your processes list. Alain On Tue, Sep 11, 2001 at 08:29:55AM +0100, jeff.waldock@blueyonder.co.uk wrote: > > > > > 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

« previous php.windows (#9336) next »