Call word macro from php error
<p>I worte a macro in 2010 office(macro is to conncet mysql database and get data put in word table)
I am trying to call this macro from php. this is the code i wrote.</p>

<pre><code>    ini_set('com.autoregister_typelib', 1); 
    ini_set('com.autoregister_verbose', 0);
    $word = new COM("Word.Application") or die('Start Word automation failed.');
    printr($word);
    $word-&gt;visible = 1;
    $worddocfile = JPATH_BASE.DS."testmacro.docx";
    printr($worddocfile);
    $word-&gt;Documents-&gt;Open($worddocfile);
    echo $word-&gt;ActiveDocument-&gt;Variables(1)-&gt;Name;
    //$word-&gt;Activate;
    $word-&gt;Run("Normal.Module.activeTab");
    $word-&gt;Quit();   
</code></pre>

<p>Any configuration needed for opening a word document. I am getting this error.     </p>

<blockquote>
  <p>( ! ) Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft Word
  Description: This command is not available because no document is open.' in C:\wamp\www\joomla\components\com_mycomponent\models\callmacro.php on line 1265<br>
  ( ! ) com_exception: Source: Microsoft Word
  Description: This command is not available because no document is open. in C:\wamp\www\joomla\components\com_mycomponent\models\callmacro.php on line 1265   </p>
</blockquote>

<p>can you please tell me what i did wrong in the code or need some configuration.</p>

<p>with out using this code i tried to call a bat file but calling a bat file is also not working. I just want run that word macro form php code.</p>

<p>Thank you...</p>
