Search code examples
javamacrosstruts2ms-wordstruts

run word macros without open word window


i'm trying to execute msword macro from Java code using this:

 Runtime rt = Runtime.getRuntime();
 Process process = rt.exec("WINWORD.EXE  <macroname> /w /m");

when this command executed the word open and close. is there a way to run word macros in background without opening the msword window and close?


Solution

  • I doubt that what you are asking is possible because you are sending a direct command to Process.

    One way I would overcome this, is to create a VBS file one the file systems (in this file I would create the MSWORD object, hide it and then send the macro command ).

    And then run the vbs file using java