error while creating word file

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
kkr653
Forum Newbie
Posts: 2
Joined: Mon Jan 16, 2012 7:50 am

error while creating word file

Post by kkr653 »

i have run the following code

<?php
// 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("anp.doc");

//closing word
$word->Quit();

//free the object
$word = null;
?>


BUT IT SHOWS THE FOLLOWING ERROR
Loaded Word, version 12.0
Fatal error: Cannot pass parameter 1 by reference in F:\wamp\www\dddddddddd\worddd.php on line 13
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: error while creating word file

Post by social_experiment »

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply