Thứ Sáu, 8 tháng 1, 2021

Code VBA thiết lập trang in A4 máy in Laser trong Excel

Sub Setup_trangin_A4()
On Error Resume Next
'.PaperSize = xlPaperA4 "Trang In lien tuc A4
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(mayin.Range("b5").Value)
.RightMargin = Application.InchesToPoints(mayin.Range("b6").Value)
.TopMargin = Application.InchesToPoints(mayin.Range("b7").Value)
.BottomMargin = Application.InchesToPoints(mayin.Range("b8").Value)
.HeaderMargin = Application.InchesToPoints(mayin.Range("b9").Value)
.FooterMargin = Application.InchesToPoints(mayin.Range("b10").Value)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
End Sub
Previous Post
Next Post

0 nhận xét: