Page 1 of 1

Run a word macro through php

Posted: Thu Oct 04, 2012 10:43 am
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.

Re: Run a word macro through php

Posted: Thu Oct 04, 2012 12:02 pm
by Christopher

Re: Run a word macro through php

Posted: Mon Oct 08, 2012 10:22 am
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.

Re: Run a word macro through php

Posted: Tue Oct 09, 2012 12:17 pm
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