Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Printing Multiple Sheets

I have multiple Checkbox controls on a VBForm and have a macro that evaluates
each one and if true, prints a corresponding range from the sheet. I need to
change this so that all of the different print jobs are combined into one job
and one job is sent to the printer (or in this case a image writer).
Additionally, I need to be able to set page numbers starting with the first
true case and then counting through the entire document, ie not reseting on
the second range.

Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Printing Multiple Sheets

The following example should give you a lead as to how to attack the problem.
You need to save each range to be printed in cells somewhere out of the way
in a worksheet. When you want to print them, retrieve the ranges and set the
print area with the multiple retrieved ranges.

The first procedure below saves the ranges and then the second one retrieves
them and sets the print area.

If you can set all the individual ranges for printing without exiting the
procedure to perform manual work then you could run the whole lot as one
macro without saving the individual ranges to a worksheet. Simply save them
to the variables and you then would not have to retrieve them. The way I have
done it allows you to run whatever procedure you want for each individual
section of the print and save its range.

Do the print setup as per the comments at the bottom of the second procedure.

The ranges I have used in the example would all fit on one sheet if selected
as one single print range but as multiple ranges in the print area , they
print on separate sheets. I don't think that you can alter that. However,
they do number consecutively.

Dim PrtRnge1 As Range
Dim PrtRnge2 As Range
Dim PrtRnge3 As Range
Dim PrtRnge4 As Range
Dim FullPrtRnge As Range

Sub Save_Multi_Print_Ranges()
'Save each individual range to cells on a worksheet

Sheets("Sheet1").Select
Set PrtRnge1 = Range("A1:D7")
Sheets("Sheet1").Range("AA1") = PrtRnge1.Address
Set PrtRnge2 = Range("C18:G25")
Sheets("Sheet1").Range("AA2") = PrtRnge2.Address
Set PrtRnge3 = Range("B30:H37")
Sheets("Sheet1").Range("AA3") = PrtRnge3.Address
Set PrtRnge4 = Range("C44:E51")
Sheets("Sheet1").Range("AA4") = PrtRnge4.Address
End Sub

Sub Retrieve_Multi_Print_Ranges()
'Retrieve the individual print ranges
'and the set print area
Sheets("Sheet1").Select
Set PrtRnge1 = Sheets("Sheet1").Range(Range("AA1"))
Set PrtRnge2 = Sheets("Sheet1").Range(Range("AA2"))
Set PrtRnge3 = Sheets("Sheet1").Range(Range("AA3"))
Set PrtRnge4 = Sheets("Sheet1").Range(Range("AA4"))
Set FullPrtRnge = Application.Union _
(PrtRnge1, PrtRnge2, PrtRnge3, PrtRnge4)
ActiveSheet.PageSetup.PrintArea = FullPrtRnge.Address

'After running this macro to this point, stop it
'here and then simply record the page set up for
'your print headers and page numbering etc and
'then insert the code here
End Sub

Hope this helps.

Regards,

OssieMac




"Troubled User" wrote:

I have multiple Checkbox controls on a VBForm and have a macro that evaluates
each one and if true, prints a corresponding range from the sheet. I need to
change this so that all of the different print jobs are combined into one job
and one job is sent to the printer (or in this case a image writer).
Additionally, I need to be able to set page numbers starting with the first
true case and then counting through the entire document, ie not reseting on
the second range.

Thanks for your help.

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
Printing multiple sheets... MarkN Excel Discussion (Misc queries) 1 December 1st 09 10:20 AM
Need Help with printing multiple sheets Please Razzcul[_2_] Excel Programming 7 August 19th 06 07:13 PM
Still Looking for help on printing multiple sheets Little Penny Excel Programming 2 August 18th 06 11:56 PM
Printing Multiple sheets light_life_love Excel Discussion (Misc queries) 0 August 25th 05 08:52 PM
Printing multiple sheets. sungen99[_3_] Excel Programming 2 May 6th 04 08:41 PM


All times are GMT +1. The time now is 04:31 AM.

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"