• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

Problem reading word file using COM in php

Can no one help with this? I have search all over the internet in messageboards and articles. Everyone seems to just give up on this error. Surely there is someone who knows how to fix it.

PHP Warning: Invoke() failed: Exception occurred. Source: Microsoft Word Description: Could not open macro storage. in c:\inetpub\wwwroot\convert.php on line 18

Here is the code I am using


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

// if you want see the World interface the value must be '1' else '0'
$word->Visible = 1;

//doc file location

//html file location  '8' mean HTML format

//closing word


I have checked that the IUSER in security settings is set to interactive.
I have checked for case sensitivity.

All help or even ideas would be greatfully appreciated.
1 Solution
1. make sure word isn't open
2. check the win2k process list because for every time the script crashes you have a winword.exe sitting there.
reason. it opens win word at the beginning of the script if it crashes before it gets to the quit your up a creak.
note: it was actually kind of funny. by the time I realized it I had 30 * winword.exe running.

check this out:

when i did this i was only createing a new file test this:

$word=new COM("Word.Application") or die("Cannot start word for you");
print "Loaded word version ($word->Version)\n";

$word->visible =1 ;
$word->Selection->Typetext("testing ....");
print "Done ...........\n";

hope it helps


Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now