Hi

I need to open a set of files 1 ant a time process the file by running a
macro (already Written) then move on to the next file in the list can anyone
help i am using word 2003 and 2007

Thanks in advance

Mark Reid

RE: Loopin through files in a directory by ryguy7272

ryguy7272
Tue Apr 01 11:41:02 PDT 2008

http://word.mvps.org/faqs/macrosvba/BatchFR.htm

General Link (permits searching for various resources):
http://word.mvps.org/



Regards,
Ryan--
--
RyGuy


"Mark Reid" wrote:

> Hi
>
> I need to open a set of files 1 ant a time process the file by running a
> macro (already Written) then move on to the next file in the list can anyone
> help i am using word 2003 and 2007
>
> Thanks in advance
>
> Mark Reid
>
>

Re: Loopin through files in a directory by Graham

Graham
Wed Apr 02 01:39:15 PDT 2008

Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

With fDialog
.Title = "Select Folder containing the documents to be modifed and click
OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
PathToUse = fDialog.SelectedItems.Item(1)
If Right(PathToUse, 1) <> "\" Then PathToUse = PathToUse + "\"
End With

If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
myFile = Dir$(PathToUse & "*.do?")

While myFile <> ""
Set myDoc = Documents.Open(PathToUse & myFile)

'*******************************************
'do your stuff
'*******************************************
myDoc.Close SaveChanges:=wdSaveChanges
myFile = Dir$()
Wend



--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



Mark Reid wrote:
> Hi
>
> I need to open a set of files 1 ant a time process the file by
> running a macro (already Written) then move on to the next file in
> the list can anyone help i am using word 2003 and 2007
>
> Thanks in advance
>
> Mark Reid