COM functions in PHP (making word document)

Got Haggis?

Veteran XX
anyone done this? I am trying...but it's not working. I have word installed on the server.

here is the code i'm using

<?
// starting word
$word = new COM("word.application") or die("Unable to instantiate 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 = null;
?>

and this is the error message i get when i try and run it

Loaded Word, version 9.0
Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft Word Description: Could not open macro storage. in D:\www\ranetweb\apps\word_test.php on line 10

Warning: (null)(): Invoke() failed: Exception occurred. Source: Microsoft Word Description: The requested member of the collection does not exist. in D:\www\ranetweb\apps\word_test.php on line 14

any idea how i can fix this? Something wrong with word macros or something?
 
or give the IUSER_IIS_SUCKS account permission to do whatever it is you want it to do.
 
edit: Nevermind. I read further, and I see that you narrowed it down to something else.
 
Last edited:
Back
Top