Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Visible Sheets Macro Lisa C. Excel Discussion (Misc queries) 1 April 6th 09 06:08 AM
Print embedded charts from several sheets Steve Charts and Charting in Excel 1 October 4th 06 03:17 AM
Macro to open print window and set to print entire workbook retseort Excel Discussion (Misc queries) 1 October 27th 05 11:00 PM
Spreadsheet print including macro buttons? gunga Excel Discussion (Misc queries) 4 February 10th 05 06:30 PM
macro to select sheets/page in a workbook and print them Todd Excel Programming 1 June 8th 04 04:19 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"