Hum,,, how does com with php work....
Posted: Fri Jan 12, 2007 1:01 pm
i am trying to open an instance of notepad through php.
below is the code.
but when i run that php file i get this
what am i doing wrong
below is the code.
Code: Select all
<?php
// starting word
$word = new COM("word.application");
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 = null;
?>Code: Select all
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `word.application': Invalid syntax ' in F:\Database Program\WEBPROGRAM\com.php:4 Stack trace: #0 F:\Database Program\WEBPROGRAM\com.php(4): com->com('word.applicatio...') #1 {main} thrown in F:\Database Program\WEBPROGRAM\com.php on line 4