ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automated Printing (https://www.excelbanter.com/excel-programming/280909-automated-printing.html)

Brady Snow

Automated Printing
 
Maybe somebody has encountered a request similar to
his... I have a user that has 3 or 4 different workbooks
and he wants to print all of them with consecutive page
numbers. The user now spends hours doing the page
numbering. What would be the best way to handle this in an
automated fashion?

Many thanks!

Brady Snow
McKinney, Texas




Tom Ogilvy

Automated Printing
 
The easiest might be to pull a copy of all the sheets into a single
workbook, group the sheets and print the workbook. Then delete this dummy
workbook.

Sub Print4Books()
Dim wkbk as Workbook
' create new book with sheets from first workbook
Workbooks("Book1.xls").Sheets.copy
' set a reference to the new workbook
set wkbk = ActiveWorkbook
' copy sheets from second
Workbooks("Book2.xls").Sheets.Copy _
After:=wkbk.worksheets(wkbk.worksheets.count)
' copy sheets from third
Workbooks("Book3.xls").Sheets.Copy _
After:=wkbk.worksheets(wkbk.worksheets.count)
' copy fourth
Workbooks("Book4.xls").Sheets.Copy _
After:=wkbk.worksheets(wkbk.worksheets.count)
' print sheets
wkbk.WorkSheets.Select
wkbk.Windows(1).SelectedSheets.Printout
' delete wkbk
wkbk.close SaveChanges:=False

End Sub

Assumes the workbooks are all open when you run the macro.


--
Regards,
Tom Ogilvy

"Brady Snow" wrote in message
...
Maybe somebody has encountered a request similar to
his... I have a user that has 3 or 4 different workbooks
and he wants to print all of them with consecutive page
numbers. The user now spends hours doing the page
numbering. What would be the best way to handle this in an
automated fashion?

Many thanks!

Brady Snow
McKinney, Texas







All times are GMT +1. The time now is 11:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com