solo9300
10-13-2004, 07:17 PM
hello all,
I am trying to wirte a MS word doucment but i get this error:
Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Word
Description: Word could not fire the event.' in C:\Inetpub\PHP\my.php:10 Stack trace: #0 {main} thrown in C:\Inetpub\PHP\my.php on line 10
-------------------------------------------------------------
this is the code i used
<?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;
?>
Any help would be much appreciated
I am trying to wirte a MS word doucment but i get this error:
Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Word
Description: Word could not fire the event.' in C:\Inetpub\PHP\my.php:10 Stack trace: #0 {main} thrown in C:\Inetpub\PHP\my.php on line 10
-------------------------------------------------------------
this is the code i used
<?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;
?>
Any help would be much appreciated