PDA

View Full Version : Command line, run a macro within an/any existing document?



ralphky
01-04-2014, 11:24 AM
Suppose I want to run a Macro with an/any existing document

Like, a Macro to insert "Hello World" into a word document.

I have tried Winword.exe /MMymacro But that creates a new instance of word.

How do I run it within an existing instance, or existing word document - but calling it from the command line?

fumei
01-04-2014, 04:48 PM
AFAIK you can not execute a Word macro on its own as it uses VBA (an instance), and there are no commandline instructions that can access an existing instance.

ralphky
01-05-2014, 06:19 AM
The macro is stored within word. I have the name of the macro I want to execute.

macropod
01-05-2014, 02:50 PM
If you want to run a macro in another document from the existing Word instance, you have to open that document, then call its macro.