Pick one, change the path and the print area range address:
Sub PrintOneSheetFromAllFilesInFolder()
With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\Excel"
.FileType = msoFileTypeExcelWorkbooks
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open .FoundFiles(i)
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$12"
ActiveSheet.PrintOut
ActiveWorkbook.Close True
Next i
End If
End With
End Sub
Sub PrintAllSheetsFromAllFilesInFolder()
Dim mySht As Worksheet
With Application.FileSearch
.NewSearch
.LookIn = "C:\Documents and Settings\Excel"
.FileType = msoFileTypeExcelWorkbooks
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open .FoundFiles(i)
For Each mySht In ActiveWorkbook.Worksheets
mySht.PageSetup.PrintArea = "$A$1:$D$12"
mySht.PrintOut
Next mySht
ActiveWorkbook.Close True
Next i
End If
End With
End Sub
You can try this macro for all files in the folder C:\Data
It will print A1:C1 from the first sheet of every workbook
See this line
Sub Example1()
Dim mybook As Workbook
Dim sourceRange As Range
Dim destrange As Range
Dim rnum As Long
Dim SourceRcount As Long
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String
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.