Batch file Open Word, run macro

Jun 22, 2012
Reaction score
I am trying to create a batch file that will open Word and run a specific macro using the /m[macro] switch. The macro in Word does some stuff, saves the file, and closes Word.

This is what I have got so far:
for %%x in (*.doc) do start /wait "winword.exe" "%%x" /mMACRO1

When placed in the same dir as all the Word files I wish to edit, it will open the first file but MACRO1 will not run. If I close the window the next Word doc will open but again, the macro does not run.

I suspect it is something fairly simple I am missing.

Running the below from the Run window works flawlessly:
winword.exe "c:\path\file.docx" /mMACRO1

Any idea what I'm missing?

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question