Print all .xls files in selected directory

  • Thread starter Thread starter LB79
  • Start date Start date
L

LB79

Does anyone know of a way that i can create a macro that prints all .xl
files in a particular diretory?

Thank
 
Try:

Sub PrintAllinFolder()
Dim i As Long
Dim WB As Workbook
Application.ScreenUpdating = False
With Application.FileSearch
.NewSearch
.LookIn = "C:\My Documents\MyFolderName"
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
If .Execute() > 0 Then
For i = 1 To .FoundFiles.Count
Set WB = Workbooks.Open(.FoundFiles(i))
WB.PrintOut
WB.Close SaveChanges:=False
Next i
End If
End With
Application.ScreenUpdating = True
End Sub


Feedback appreciated...
I use Excel - XP
Jim May
 

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

Back
Top