Print Batch of Files Recursively

S

Steve

I've got a folder with two lower levels of folders. I need to print all the
files in all level of folders. How do I do this recursively?

Thanks,
Steve
 
J

Jonathan West

Steve said:
I've got a folder with two lower levels of folders. I need to print all the
files in all level of folders. How do I do this recursively?

Like this...

Dim oDoc as Doc
Dim i as Long
With Application.FileSearch
.Lookin = "put the full pathname top level folder here"
.SearchSubfolders = True
.FileName = "*.doc"
.Execute
For i = 1 to .FoundFiles.Count
Set oDoc = Documents.Open(.FoundFiles(i))
oDoc.Printout Background:=False
oDoc.Close SaveChanges:=wdDoNotSaveChanges
Next i
End With
 
S

Steve

Thanks, Jonathan. Does the FileSearch method automatically handle all
subfolders? I don't have to do this recursively myself?
Steve
 
S

Steve

Works beautifully. thanks.

Jonathan West said:
Like this...

Dim oDoc as Doc
Dim i as Long
With Application.FileSearch
.Lookin = "put the full pathname top level folder here"
.SearchSubfolders = True
.FileName = "*.doc"
.Execute
For i = 1 to .FoundFiles.Count
Set oDoc = Documents.Open(.FoundFiles(i))
oDoc.Printout Background:=False
oDoc.Close SaveChanges:=wdDoNotSaveChanges
Next i
End With


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
 
J

Jonathan West

Steve said:
Thanks, Jonathan. Does the FileSearch method automatically handle all
subfolders? I don't have to do this recursively myself?
Steve

Yes, that is handled by the SearchSubfolders property
 

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