엑셀

엑셀 vba func_Print_Seting 프린터 설정

아스C# 2018. 11. 24. 10:30
반응형


Sub func_Print_Seting(rng As String, headerStr As String, margin As Integer)

  Application.Calculation = xlCalculationManual

  Application.ScreenUpdating = False

    ActiveSheet.PageSetup.PrintArea = rng '"$A$300:$S$742"

    With ActiveSheet.PageSetup

        .CenterHeader = headerStr

        .RightHeader = "&P/&N"

        .Orientation = xlLandscape  ' xlPortrait ?

        .Draft = False

        .PaperSize = xlPaperA4

        .FirstPageNumber = xlAutomatic

        

        .LeftMargin = Application.InchesToPoints(0.196850393700787)

        .RightMargin = Application.InchesToPoints(0.196850393700787)

        .TopMargin = Application.InchesToPoints(0.393700787401575)

        .BottomMargin = Application.InchesToPoints(0.196850393700787)

        .HeaderMargin = Application.InchesToPoints(0.196850393700787)

        .FooterMargin = Application.InchesToPoints(0)

'        .Zoom = False

'        .FitToPagesWide = 2 '용지 너비

'        .FitToPagesTall = 3 ' 용지 높이

    End With

      Application.ScreenUpdating = True

      Application.Calculation = xlCalculationAutomatic

End Sub


Sub trPrint_Preview(ByRef stnames)

    Sheets(stnames).Select

    Sheets(stnames).PrintPreview

End Sub




반응형