View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Printing multiple (selected) workbooks

Mark,

Sub PrintAllSheetsInUserSelectedFiles()
Dim FileArray As Variant
Dim myBook As Workbook
Dim mySht As Worksheet

FileArray = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(FileArray) Then
For i = LBound(FileArray) To UBound(FileArray)
Workbooks.Open FileArray(i)
Set myBook = ActiveWorkbook
For Each mySht In myBook.Worksheets
mySht.PrintOut
Next mySht
myBook.Close False
Next i
End If
End Sub

HTH,
Bernie
MS Excel MVP


"markx" wrote in message
...
Hello guys,

I was checking the web (and found nothing) for a macro that would allow me to print multiple
workbooks, a bit like with the "right-click/print" function in MS Explorer. This function has
however two drawbacks:
- prints only the first worksheet (and not the total workbook)
- opens the file (so it's slower), and - very often - "unnecessarily" asks if I want to save the
file before closing and opening the next one.

Do you know how should such an 'enhanced' macro look like? Thanks for any suggestions.
Regards,

Mark