I need to run the macro below on consecutive open files. I have already run this clicking the macro button for each open file, but it doesn't allow me to do anything else except sit and click the button again and again and again. Surely there's a line of code that that I'm missing to allow for the macro to run on file 1, save and close that file and then proceed to repeat the macro action on file 2, save, close, move on to file 3, etc. So no matter if there's 5, 25, or 100, the macro repeats the same action until there are no more open files to run on. This way I can multi-task instead of being tethered to clicking this button.
To be clear, I'm not talking about multiple pages within a file. These are all completely separate files, one page for each. (Tiny file sizes, so no issue with how many are open at once.)
==
Sub MACRO_16() With ActiveDocument.MasterPage .SetSize 3.414, 3.414 .Orientation = cdrPortrait .PrintExportBackground = True .Bleed = 0# .Background = cdrPageBackgroundNone End With ActiveDocument.ReferencePoint = cdrCenter ActivePage.Shapes.All.CreateSelection ActiveSelection.SetSize 3#, 0# ActiveSelection.Move -0.025, 0# ActiveSelection.Move 0#, 0.05 ActiveSelection.Fill.UniformColor.RGBAssign 0, 0, 0 ActiveDocument.Save ActiveDocument.Close End Sub
Thanks!
try code below
Sub ProcessAllOpenedDocs() Dim d As DocumentFor Each d In Documentsd.ActivateWith ActiveDocument.MasterPage . SetSize 3.414, 3.414 .Orientation = cdrPortrait .PrintExportBackground = True .Bleed = 0# .Background = cdrPageBackgroundNone End With ActiveDocument.ReferencePoint = cdrCenter ActivePage.Shapes.All.CreateSelection ActiveSelection.SetSize 3#, 0# ActiveSelection.Move -0.025, 0# ActiveSelection.Move 0#, 0.05 ActiveSelection.Fill.UniformColor.RGBAssign 0, 0, 0 ActiveDocument.Save ActiveDocument.Close Next dEnd Sub
Mek - you nailed it! Works perfectly. My sincerest gratitude for your help.
You are welcome.