COM object `Word.Application' error

liunx

Guest
Hi, I am just starting working on a PHP using COM and below is my code with a simple code below:
<?
$invoice = "C:/wamp/www/phpcom/Doc6.doc";

$title = "Osram Opto Semiconductor";

$word = new COM("Word.Application") or die("Cannot open Mic Word");
print "Loaded Version ($word->Version)\n";
$word->visible = 1;
$word->Documents->Open($invoice);

$word->Application->Run("BmkKTitle");
$word->Selection->Typetext($title);


$word->Application->ActiveDocument->Saved=True;
while($word->Appication->BackgroundPrintingStatus>0){sleep (1);}

$word->Quit();
$word->Release();
$word = null;
?>

Problem: I did create macro named "BmkKTitle" in Micsft. Word, but I got error as below:


Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `Word.Application': Not enough storage is available to complete this operation. ' in c:\wamp\www\phpcom\word.php:14 Stack trace: #0 c:\wamp\www\phpcom\word.php(14): com->com('Word.Applicatio...') #1 {main} thrown in c:\wamp\www\phpcom\word.php on Line ..


Anyone has a solution or at least an advice??
 
Back
Top