Sub in_giayhen()
With Sheet15
'lua chon kho giay (xlPaperA4 = A4,xlPaperA5 = A5)
.PageSetup.PaperSize = xlPaperA4
' trang ngang hay trang doc (xlPortrait: doc, xlLandscape: ngang)
.PageSetup.Orientation = xlPortrait
'chon may in
Application.Dialogs(xlDialogPrinterSetup).Show
' khu vuc in
.Range("A1:CN68").PrintOut
'fit tat ca cot trong 1 trang
Application.PrintCommunication = False
.PageSetup.FitToPagesWide = 1
.PageSetup.FitToPagesTall = False
Application.PrintCommunication = True
End With
End Sub
CHỌN RA MÁY IN VÀ IN LUON
Sub chonmayin() ' dung de chon may in mac dinh khi in
Dim mayin
mayin = Application.Dialogs(xlDialogPrinterSetup).Show
Range("A6").Value = ActivePrinter
With Sheet4
.PageSetup.PaperSize = xlPaperA4 'chon said giay A4
.PageSetup.Orientation = xlPortrait 'xlLandscape: in ngang, xlPortrait: In doc
.PageSetup.PrintArea = "A2:AT153" 'chon khu vuc de in
' fit cac cot trong 1 trang
Application.PrintCommunication = False
.PageSetup.FitToPagesWide = 1
.PageSetup.FitToPagesTall = False
Application.PrintCommunication = True
'in ra giay
.PrintOut ActivePrinter:=Sheets("Caidat").Range("A6").Value, collate:=True 'tu trang.....den trang
End With
End Sub
IN SAU ĐÓ ẨN LUÔN
Sub In_mosotietkiem()
' chon may can in, tao sheet co ten la (In_an)
Dim mayin
mayin = Application.Dialogs(xlDialogPrinterSetup).Show
Range("A1000").Value = ActivePrinter
' andong khi in
If Range("C60") <> "" Then Exit Sub 'C60 la dong cuoi cung
Application.ScreenUpdating = False
Dim Lr As Long
Lr = Range("C60").End(xlUp).row + 1
Range("C60:C" & Lr).EntireRow.Hidden = True 'an dong thua
' in chung tu
With Sheet35
.PageSetup.PaperSize = xlPaperA4 'chon said giay A4
.PageSetup.Orientation = xlPortrait 'xlLandscape: in ngang, xlPortrait: In doc
.PageSetup.PrintArea = "A1:K68" 'chon khu vuc de in
' fit cac cot trong 1 trang
Application.PrintCommunication = False
.PageSetup.FitToPagesWide = 1
.PageSetup.FitToPagesTall = False
Application.PrintCommunication = True
'in ra giay
.PrintOut ActivePrinter:=Sheets("In_an").Range("A1000").Value, collate:=True 'tu trang.....den trang
End With
' sau khi in xong thi hien lai các dong
Range("C11:C60").EntireRow.Hidden = False 'hien lai
Application.ScreenUpdating = True
End Sub
Sub in_giayhen()
Application.Dialogs(xlDialogPrinterSetup).Show
With Sheet4
.PageSetup.PaperSize = xlPaperA4 'chon said giay A4
.PageSetup.Orientation = xlPortrait 'xlLandscape: in ngang, xlPortrait: In doc
.PageSetup.PrintArea = "A2:Ap74" 'chon khu vuc de in
' fit cac cot trong 1 trang
Application.PrintCommunication = False
.PageSetup.FitToPagesWide = 1
.PageSetup.FitToPagesTall = False
Application.PrintCommunication = True
Sheet4.PrintOut
End With
End Sub