Page 1 of 1

word: php + com trouble

Posted: Wed Feb 16, 2005 6:45 am
by quarry_06
Hi
I have following code:

Code: Select all

com_load_typelib('Word.Application');

error_reporting(E_ALL);

$empty = new VARIANT();
$Word = new COM('word.application') or die('Unable to load Word');

$Word->Documents->Open("C:\\zert.doc");
$Word->Selection->GoTo(wdGoToBookmark,$empty,$empty,'CertNumber');
//crucial line
$Word->Selection->TypeText("some text");
$Word->Documentsї1]->SaveAs("C:\\some_file.doc");
When I comment line with GoTo, the script executes fine, but when I uncomment it, the script doesn't work.
and I the heck don't know why. I am loading the constant wdGoToBookmark with the function com_load_typelib('Word.Application');, so this should work.

I don't get an error, but simply the script never stops and I get an error that apache2.exe has crashed.

do I have to install anything to use these com functions?
or why does it not work

any help very appreciated!!!

quarry