Someone else sent me this code example and it worked perfectly for the task I was working on. He admitted that he didn't know enough about the workings of the code to offer much advice, but was able to find it for me...so thanks!
So I'm using this code for it's intended purpose, but now I'm trying to made a modification (either to it, or as a separate macro) that will allow the same subset of sheets to be printed as either only odd pages (front) or only even pages (back). The best part about this code is that it puts all of the applicable sheets to print into a single print job. There's over 75 double-sided pages to print, so I'm trying to avoid a macro that prints just odd or just even pages, but still sends the job as 75+ different print jobs. Can anyone help?
So I'm using this code for it's intended purpose, but now I'm trying to made a modification (either to it, or as a separate macro) that will allow the same subset of sheets to be printed as either only odd pages (front) or only even pages (back). The best part about this code is that it puts all of the applicable sheets to print into a single print job. There's over 75 double-sided pages to print, so I'm trying to avoid a macro that prints just odd or just even pages, but still sends the job as 75+ different print jobs. Can anyone help?
This procedure prints all sheets except those whose names are passed in as parameters. Example usage:
This prints all sheets except Sheet2, Sheet4, and Sheet6. The code is shown below:Code:[COLOR=#000080][FONT="]PrintSheetsExclude false, "Sheet2", "Sheet4", "Sheet6"[/FONT][/COLOR]
Code:Sub PrintSheetsExclude(Preview As Boolean, ParamArray Excludes() As Variant) [COLOR=#008000]''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' PrintSheetsExclude ' This prints all sheets except those included as parameters. ' It is legal for Excludes to include sheet names that ' do not exist. If no sheet names are passed in, all ' sheets are printed. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''[/COLOR] Dim Arr() As String Dim B As Boolean Dim N As Long Dim M As Long Dim K As Long ReDim Arr(1 To Sheets.Count) For N = 1 To Sheets.Count B = True For M = LBound(Excludes) To UBound(Excludes) If StrComp(Sheets(N).Name, Excludes(M), vbTextCompare) = 0 Then B = False Exit For End If Next M If B = True Then K = K + 1 Arr(K) = Sheets(N).Name End If Next N If K > 0 Then ReDim Preserve Arr(1 To K) Sheets(Arr).PrintOut Preview:=Preview End If End Sub