Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Print Visible Sheets Macro | Excel Discussion (Misc queries) | |||
Print embedded charts from several sheets | Charts and Charting in Excel | |||
Macro to open print window and set to print entire workbook | Excel Discussion (Misc queries) | |||
Spreadsheet print including macro buttons? | Excel Discussion (Misc queries) | |||
macro to select sheets/page in a workbook and print them | Excel Programming |