![]() |
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook
I thought that this would do it but it is giving me an error of:
1004 Methough PrintOut of object Sheets failed Sub PrintMacro() vCopies = InputBox("How Many Copies?") i = 1 For i = 1 To vCopies Sheets.PrintOut Next i End Sub Any help is appreciated Thanks |
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook
Hi Will
Try this Sub Print_Visible_sheets() 'xlSheetVisible = -1 Dim sh Dim arr() As String Dim N As Integer N = 0 For Each sh In ThisWorkbook.Sheets If sh.Visible = -1 Then N = N + 1 ReDim Preserve arr(1 To N) arr(N) = sh.Name End If Next ThisWorkbook.Sheets(arr).PrintOut Sheets(1).Select End Sub More info here http://www.rondebruin.nl/print.htm#visible -- Regards Ron de Bruin http://www.rondebruin.nl "will" wrote in message om... I thought that this would do it but it is giving me an error of: 1004 Methough PrintOut of object Sheets failed Sub PrintMacro() vCopies = InputBox("How Many Copies?") i = 1 For i = 1 To vCopies Sheets.PrintOut Next i End Sub Any help is appreciated Thanks |
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook
No luck with this working. The problem is that arr(N) is not getting
the actual name of the worksheet it is just putting in "Sheet1" "Sheet2" "Sheet3" etc... Whereas the names of my sheets are "Data" "XYZ" "YTD" etc... Thoughts? "Ron de Bruin" wrote in message ... Hi Will Try this Sub Print_Visible_sheets() 'xlSheetVisible = -1 Dim sh Dim arr() As String Dim N As Integer N = 0 For Each sh In ThisWorkbook.Sheets If sh.Visible = -1 Then N = N + 1 ReDim Preserve arr(1 To N) arr(N) = sh.Name End If Next ThisWorkbook.Sheets(arr).PrintOut Sheets(1).Select End Sub More info here http://www.rondebruin.nl/print.htm#visible -- Regards Ron de Bruin http://www.rondebruin.nl "will" wrote in message om... I thought that this would do it but it is giving me an error of: 1004 Methough PrintOut of object Sheets failed Sub PrintMacro() vCopies = InputBox("How Many Copies?") i = 1 For i = 1 To vCopies Sheets.PrintOut Next i End Sub Any help is appreciated Thanks |
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook
Hi Will
It will work correct Where do you copy the macro -- Regards Ron de Bruin http://www.rondebruin.nl "will" wrote in message om... No luck with this working. The problem is that arr(N) is not getting the actual name of the worksheet it is just putting in "Sheet1" "Sheet2" "Sheet3" etc... Whereas the names of my sheets are "Data" "XYZ" "YTD" etc... Thoughts? "Ron de Bruin" wrote in message ... Hi Will Try this Sub Print_Visible_sheets() 'xlSheetVisible = -1 Dim sh Dim arr() As String Dim N As Integer N = 0 For Each sh In ThisWorkbook.Sheets If sh.Visible = -1 Then N = N + 1 ReDim Preserve arr(1 To N) arr(N) = sh.Name End If Next ThisWorkbook.Sheets(arr).PrintOut Sheets(1).Select End Sub More info here http://www.rondebruin.nl/print.htm#visible -- Regards Ron de Bruin http://www.rondebruin.nl "will" wrote in message om... I thought that this would do it but it is giving me an error of: 1004 Methough PrintOut of object Sheets failed Sub PrintMacro() vCopies = InputBox("How Many Copies?") i = 1 For i = 1 To vCopies Sheets.PrintOut Next i End Sub Any help is appreciated Thanks |
All times are GMT +1. The time now is 01:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com