clhare
03-21-2008, 08:21 AM
I have a macro that needs to run on all open templates, but for some reason it only runs on a few files, then stops. I just updated 16 templates using this macro and had to run the macro 5 times to get through them all. Is there a better way to cycle through that makes sure there are no more open files before quitting? Here's what I currently have in this macro:
Dim objDoc As Word.Document
' Update one document at a time
For Each objDoc In Documents
objDoc.Activate
' ... perform my updates
' Save and close file
ActiveDocument.Close savechanges:=wdSaveChanges
' Update next active document
Next objDoc
Any help would be greatly appreciated!
Dim objDoc As Word.Document
' Update one document at a time
For Each objDoc In Documents
objDoc.Activate
' ... perform my updates
' Save and close file
ActiveDocument.Close savechanges:=wdSaveChanges
' Update next active document
Next objDoc
Any help would be greatly appreciated!