Printing multiple (selected) workbooks

  • Thread starter Thread starter markx
  • Start date Start date
M

markx

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
 
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
 

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