English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Every month, I have a folder full of around 70 word documents that all have to be modified in the same way. So, I wrote a macro that will modify each document. Now I would like to find a way to write a batch file or script that can process each word document in a particular folder. I want it to go through each document in the folder and run the macro.

It sounds simple enough but I don't know how to do it :(
Anyone have any ideas. Thanks to anyone who gives can help out. :)

2006-10-05 04:40:03 · 1 answers · asked by Bang Boom 2 in Computers & Internet Programming & Design

Ok well no one answered me but I figured it out. You can write another macro to do this. Here is what I have:

Sub Automation()

Dim sFile$
Const path = "C:\Documents and Settings\username\Desktop\ORDERS\" 'this is the path where the documents are stored.

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

2006-10-06 09:02:19 · update #1

1 answers

Thats great that you found your answer :)
Now if you want to run it every month automatically, you could look into Windows SCHEDULER, or Linux CRONTAB.

I belive your in Windows cause your using VB.So goto your Control Panel, and select "Schedule Tasks"

Now add your macro there :) Set the event to be every month.

Good Luck

2006-10-08 06:03:32 · answer #1 · answered by ? 6 · 1 0

fedest.com, questions and answers