How to automate running a macro on a batch of documents?

G

Guest

Thanks for reading my question :)

How to automate running a macro on a batch of documents?

Anyone know how I can automate this process. Every month, I have to go
through a batch of documents and do modifications on each one. I developed a
macro that will modify each document. Now I can open each document and run
the macro.. but is there a way to write a batch file or script that, when
ran, will go thorough every file in a certain folder and run the macro?

Thanks for anyone who can offer advice
 
G

Guest

I looked the link, and realized I can write another macro to automate this
process. Thanks for the help. Here is what I ended up with (which I took
and modified from another post on these forums):

Sub Automation()
Dim sFile$
Const path = "C:\Documents and Settings\adna\Desktop\ORDERS\"

sFile = Dir(path & "*.doc")
Do While sFile <> ""
Documents.Open (path & sFile)
'run the macro which modifies documents
Application.Run "Project.NewMacros.MonthlyIOProcedure"
ActiveDocument.Close savechanges:=True
sFile = Dir
Loop
End Sub
 

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

Top