Option Explicit
Sub B_ack_Pr_int()
Dim i As Long, j As Long
Dim sCurPrntr As String
Dim Customer, Installers, Map, Quote, Whouse
Dim s, s1, s2, s3, s4
sCurPrntr = Application.ActivePrinter
'Schema:
'Sheet = Array(Sheetname, Orientation, Zoom, FitToPagesWide, FitToPagesTall, PaperSize, PrintQuality, _
FirstPageNumber, LeftMargin, RightMargin, TopMargin, BottomMargin, HeaderMargin, _
FooterMargin, CenterHorizontally, CenterVertically, LeftHeader, CenterHeader, _
RightHeader, LeftFooter, CenterFooter, RightFooter, OddAndEvenPagesHeaderFooter, _
EvenPageLeftHeaderText, EvenPageCenterHeaderText, EvenPageRightHeaderText, _
EvenPageLeftFooterText, EvenPageCenterFooterText, EvenPageRightFooterText, _
DifferentFirstPageHeaderFooter, FirstPageLeftHeaderText, FirstPageCenterHeaderText, _
FirstPageRightHeaderText, FirstPageLeftFooterText, FirstPageCenterFooterText, _
FirstPageRightFooterText, ScaleWithDocHeaderFooter, AlignMarginsHeaderFooter, PrintArea, _
PrintTitleRows, PrintTitleColumns, PrintGridlines, BlackAndWhite, Draft, PrintHeadings, _
PrintComments, PrintErrors, Order)
Customer = Array("Customer", xlPortrait, 100, 1, 1, xlPaperLetter, 600, xlAutomatic, _
1, 1, 1, 1, 1, 1, False, False, _
"", "", "", "", "", "", False, "", "", "", "", "", "", False, "", "", "", "", "", "", True, True, _
"", "", "", False, False, False, False, xlPrintNoComments, xlPrintErrorsDisplayed, xlDownThenOver)
Installers = Array("Installers", xlPortrait, 100, 1, 1, xlPaperLetter, 600, xlAutomatic, _
1, 1, 1, 1, 1, 1, False, False, _
"", "", "", "", "", "", False, "", "", "", "", "", "", False, "", "", "", "", "", "", True, True, _
"", "", "", False, False, False, False, xlPrintNoComments, xlPrintErrorsDisplayed, xlDownThenOver)
Map = Array("Map", xlLandscape, 100, 1, 1, xlPaperLetter, 600, xlAutomatic, _
0, 0, 0, 0, 0, 0, False, False, _
"", "", "", "", "", "", False, "", "", "", "", "", "", False, "", "", "", "", "", "", True, True, _
"", "", "", False, False, False, False, xlPrintNoComments, xlPrintErrorsDisplayed, xlDownThenOver)
Quote = Array("QUOTE", xlPortrait, 100, 1, 1, xlPaperLetter, 600, xlAutomatic, _
1, 1, 1, 1, 1, 1, False, False, _
"", "", "", "", "", "", False, "", "", "", "", "", "", False, "", "", "", "", "", "", True, True, _
"", "", "", False, False, False, False, xlPrintNoComments, xlPrintErrorsDisplayed, xlDownThenOver)
Whouse = Array("Whouse", xlPortrait, 100, 1, 1, xlPaperLetter, 600, xlAutomatic, _
1, 1, 1, 1, 1, 1, False, False, _
"", "", "", "", "", "", False, "", "", "", "", "", "", False, "", "", "", "", "", "", True, True, _
"", "", "", False, False, False, False, xlPrintNoComments, xlPrintErrorsDisplayed, xlDownThenOver)
s1 = Array(Quote, Map)
s2 = Array(Whouse, Map)
s3 = Array(Installers, Map)
s4 = Array(Customer)
s = Array(s1, s2, s3, s4)
For i = LBound(s) To UBound(s)
For j = LBound(s(i)) To UBound(s(i))
Page_Set_Up s(i)(j)
Next
Next
End Sub
Sub Page_Set_Up(psu)
Application.PrintCommunication = False
With Sheets(psu(0)).PageSetup
.Orientation = psu(1)
If psu(2) = False Then
.FitToPagesWide = psu(3)
.FitToPagesTall = psu(4)
Else
.Zoom = psu(2)
End If
.PaperSize = psu(5)
.PrintQuality = psu(6)
.FirstPageNumber = psu(7)
.LeftMargin = Application.InchesToPoints(psu(8))
.RightMargin = Application.InchesToPoints(psu(9))
.TopMargin = Application.InchesToPoints(psu(10))
.BottomMargin = Application.InchesToPoints(psu(11))
.HeaderMargin = Application.InchesToPoints(psu(12))
.FooterMargin = Application.InchesToPoints(psu(13))
.CenterHorizontally = psu(14)
.CenterVertically = psu(15)
.LeftHeader = psu(16)
.CenterHeader = psu(17)
.RightHeader = psu(18)
.LeftFooter = psu(19)
.CenterFooter = psu(20)
.RightFooter = psu(21)
.OddAndEvenPagesHeaderFooter = psu(22)
If psu(22) = True Then
.EvenPage.LeftHeader.Text = psu(23)
.EvenPage.CenterHeader.Text = psu(24)
.EvenPage.RightHeader.Text = psu(25)
.EvenPage.LeftFooter.Text = psu(26)
.EvenPage.CenterFooter.Text = psu(27)
.EvenPage.RightFooter.Text = psu(28)
End If
.DifferentFirstPageHeaderFooter = psu(29)
If psu(29) = True Then
.FirstPage.LeftHeader.Text = psu(30)
.FirstPage.CenterHeader.Text = psu(31)
.FirstPage.RightHeader.Text = psu(32)
.FirstPage.LeftFooter.Text = psu(33)
.FirstPage.CenterFooter.Text = psu(34)
.FirstPage.RightFooter.Text = psu(35)
End If
.ScaleWithDocHeaderFooter = psu(36)
.AlignMarginsHeaderFooter = psu(37)
.PrintArea = psu(38)
.PrintTitleRows = psu(39)
.PrintTitleColumns = psu(40)
.PrintGridlines = psu(41)
.BlackAndWhite = psu(42)
.Draft = psu(43)
.PrintHeadings = psu(44)
.PrintComments = psu(45)
.PrintErrors = psu(46)
.Order = psu(47)
End With
Application.PrintCommunication = True
End Sub
Bookmarks