View Single Post
 
Old 12-15-2017, 09:37 AM
twkralnc twkralnc is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2017
Posts: 1
twkralnc is on a distinguished road
Thumbs up Winword does not close as macro edits multiple files

FIXED: Application.Quit SaveChanges:=wdSaveChanges


I recorded a macro that edits an existing header and then does a save and close on the file. Works fine for single use.

When I try to run the macro against all the files in a directory, Word does not close between file edits. A blank document is presented and I have to close word to let the cmd file step to the next file.

cmd file...

for /r %%A in (*.docx) do call "C:\Program Files\Microsoft Office\root\Office16\winword.exe" /q "%%A" /mRefHeader

T han K s

Last edited by twkralnc; 12-15-2017 at 12:06 PM. Reason: solved
Reply With Quote