tags:

views:

157

answers:

1

I'm writing a command-line program that has a step in which I need to replace text in a Word file. The replacing task is accomplished using Word macro.

What I need to do now is to call this macro from command-line. At the moment we can do this by using the -mMacroName parameter of 'winword.exe', i.e. \winword.exe -mMacroName. But this need the macro to be already available as a global macro.

Since I need to run the program on another computer, I need to import the above replacing macro programatically... and I don't know how to do this.

Please help.

+1  A: 

Adding the macro using VBScript would be an option. You can find a sample to get started in the following related question:

Remove MS Word macro using VBScript

0xA3