Run a word macro through php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vennavallisagar
Forum Newbie
Posts: 3
Joined: Wed Oct 03, 2012 11:22 pm

Run a word macro through php

Post by vennavallisagar »

Hi
i am trying to run a macro in side the word-2010. But it is not running.
What i did is ..
1. I allowed COM in php.ini through uncomment com.allow_dcom = true and restarted.
2. I gave IUSER and IIS-IUSER permissions to DCOM Objects in windows 7 professional to "microsoft word 93- 2003 document" in side component services. I did same thing for my computer in side component services.
Here is my code

Code: Select all

$word = new COM("word.application") or die ("Could not initialise MS Word object.");
$word->Visible = 1;
$word->Application->Run('autoFillForm');
$word->Quit();
The result i am getting is...
1. web page is freezing but i cant see word opening (but i can see winword.exe in task manager processes)(I did not get any errors)
2. if i end the winword.exe process in task manager i can see word version echo's in php code.

I tried with batch file also but same web page freezing result i am getting. (I am not getting any errors)
Can any one please help me on this one
I am using Joomla 1.5 , PHP version si 5.2.9-2, Apache version is 2.2.11

Thank you,
Sagar.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Run a word macro through php

Post by Christopher »

(#10850)
vennavallisagar
Forum Newbie
Posts: 3
Joined: Wed Oct 03, 2012 11:22 pm

Re: Run a word macro through php

Post by vennavallisagar »

Hi Christopher,
Thanks for quick reply. I saw the links but i am not able to understand the first link(microsoft link) i.e. i gave all the permissions to the winword.exe but it is not running macro.
using second link only i wrote the code.
Can you please help me on this one
Thank you,
Sagar.
vennavallisagar
Forum Newbie
Posts: 3
Joined: Wed Oct 03, 2012 11:22 pm

Re: Run a word macro through php

Post by vennavallisagar »

Finally I got this one my own by doing some settings(Dcom objects and Apache server settings.) It is little different setting where Microsoft provided in the following link
http://support.microsoft.com/kb/257757. I need to test in windows dedicated server
Post Reply