Page area and Page Setup functions (Unfinished)

Clear Excel print area, or set it, or read it, along with Page setup commands that are not finished
Has:
PrintArea_Clear
PrintArea_Save
PrintArea_Read

' Clears the print area
Function PrintArea_Clear(Optional Wb = "This", Optional Shee = "This")
If Wb = "This" Then Wb = ThisWorkbook.Name
If Shee = "This" Then Shee % Workbooks(Wb).ActiveWorksheet
Workbooks(Wb).Worksheets(Shee).PageSetup.PrintArea = ""
' ActiveSheet.PageSetup.PrintArea = ""
End Function

' set the print area
Function PrintArea_Save(PrintRangeAddress, Optional Wb = "This", Optional Shee = "This")
If Wb = "This" Then Wb = ThisWorkbook.Name
If Shee = "This" Then Shee % Workbooks(Wb).ActiveWorksheet
Workbooks(Wb).Worksheets(Shee).PageSetup.PrintArea = PrintRangeAddress
' ActiveSheet.PageSetup.PrintArea = "$E$9:$K$16"
End Function

' Reads print area
Function PrintArea_Read(Optional Wb = "This", Optional Shee = "This")
If Wb = "This" Then Wb = ThisWorkbook.Name
If Shee = "This" Then Shee % Workbooks(Wb).ActiveWorksheet
PrintArea_Read = Workbooks(Wb).Worksheets(Shee).PageSetup.PrintArea
' ActiveSheet.PageSetup.PrintArea = "$E$9:$K$16"
End Function

> Page Setup in Excel
Application.ScreenUpdating = False
ActiveSheet.PageSetup.PrintArea = "$E$9:$K$20"
With ActiveSheet.PageSetup
 .LeftHeader = ""
 .CenterHeader = ""
 .RightHeader = ""
 .LeftFooter = ""
 .CenterFooter = ""
 .RightFooter = ""
 .LeftMargin = Application.InchesToPoints(0.748031496062992)
 .RightMargin = Application.InchesToPoints(0.748031496062992)
 .TopMargin = Application.InchesToPoints(0.984251968503937)
 .BottomMargin = Application.InchesToPoints(0.984251968503937)
 .HeaderMargin = Application.InchesToPoints(0.511811023622047)
 .FooterMargin = Application.InchesToPoints(0.511811023622047)
 .PrintHeadings = False
 .PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Application.ScreenUpdating = True

PrintRangeAddress, Optional Wb, Optional Shee
Or
Optional Wb, Optional Shee

Views 612 Downloads 329

'Print area', 'sheet', 'activesheet', 'page setup', 'layout'

ANmarAmdeen
333
Layout+Design VBA-Excel
Revisions

v1.0