Closing Excel using DCOM and Release()
| From: | Jeff Waldock | Date: | Sun, 09 Sep 2001 13:20:35 +0000 |
| Subject: | Closing Excel using DCOM and Release() | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-9264@lists.php.net to get a copy of this message | ||
I cannot seem to get PHP to recognise the Release function when tring to
close an instance of Excel or Word opened using DCOM.
This is the error message returned..
Warning: Unable to lookup release: The object invoked has disconnected from
its clients. in d:\wwwroot\studentdata\word.php on line 21
The code on line 21 is just
$word->Release();
The full code is::
<?php
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";
//bring it to front
$word->Visible = 1;
//open an empty document
$word->Documents->Add();
//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
//closing word
$word->Quit();
//free the object
$word->Release();
$word = null;
?>
Where am I going wrong?
Jeff Waldock