Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

When I run this code in PHP, it works for the first time, but when I
try reloading it again, Apache complains of access violation errors.
Got any ideas?

// starting word
$word = new COM("word.application") or die("Unable to instantiate
echo "Loaded Word, version \n";

//bring it to front
$word->Visible = 1;

//open an empty document

//closing word

//free the object
$word = null;

Re: PHP and COM

Quoted text here. Click to load it

Which versions of

etc etc?


Re: PHP and COM

"X" wrote...
Quoted text here. Click to load it


//open an empty document

I imagine it's possible that you're not closing the document
you opened when you try to shut down Word. You might need to
throw an index as the Documents[] may be an array.

I would use more appropriate variable names as well. Something
along the lines of...

$oMS_Word = new COM("word.application");
// check for $oMS_Word object or check for error.

When you create a new document, word usually asks if you'd like
to save the document. So you might want check for return values
when closing the document.

I'm interested in this topic for other reasons. I do not want to
open Word documents, I want to connect to a .dll and create an
object from a specific DLL file.

Jim Carlock
You Have More Than Five Senses

Re: PHP and COM

Quoted text here. Click to load it

The code should work, i suppose this is a bug or a missconfiguration
somewhere (Apache, PHP, OS)...


Site Timeline