$word->Selection->...INVOKE error

liunx

Guest
:eek: :rolleyes: Hi i'm having problem when i call COM objects from PHP script.
I set my XP using article from Alain (.doc) but when I run php script, the Word is open but the message "INVOKE error..." is showed in my browser...
Can you help me?
Thankspost your code.Here is... problem is in the bold line:

<?php

#*********************************************************
# This example, slightly modified from the Zend site,
# will open an instance of word with a new
# document with the name "Useless test.doc" and the line:
# "This is a test2..." typed inside.
#*********************************************************

#Instantiate the Word component.

$word = new COM("word.application") or die("Unable to instantiate Word");

#Get and print its version

print "Loaded Word, version {$word->Version}<BR>";

#Another way to get the version using com_get

//$testversion = com_get($word->application,version);

print "Version using Com_get(): $testversion <BR>";

#Make it visible in a window

$word->Visible = 1;

#Open a new document

$word->Documents->Add();

#Write something

$word->Selection->TypeText("This is a test...");#Now save the document

//$word->Documents[1]->SaveAs("Useless test.doc");

#Comment next line if you want to see the word document,
#then close word manually

//$word->Quit();
#Comment if you want to see the word document, then closeHey...
Someone can help me?
I纾
 
Back
Top