开发者

How to import a macro file (previously exported as .bas file) to Microsoft Word using command line?

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 i开发者_如何学编程s to call this macro from command-line. At the moment we can do this by using the /mMacroName parameter of 'winword.exe', i.e. <path-to-msoffice>\winword.exe /mMacroName. But this needs 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 programmatically... and I don't know how to do this.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜