When I run a test code for com object in php I am getting a fatal error of PHP Fatal error: Call to a member function TypeText() on a non-object in C:\inetpub\wwwr oot\test.php on line 13. Here is the code I am using
Can someone please help me on this
Code:
<?php
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
echo "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;
header('Content-Type: application/msword');
?>
Comment