Xin các bác hỗ trợ em về thiết lập trang in bằng VBA trong Word ạ!

Liên hệ QC

trungtamcnc

Thành viên hoạt động
Tham gia
5/4/10
Bài viết
124
Được thích
9
Em có code như sau ạ:
Sub In()
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentWithMarkup, Copies:=1, Pages:="2,20", PageType:= _
wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End sub
Như trên code, em đang chọn in trang 2 và 20. Các bác sửa code giúp em: Làm sao đưa được biến vào chỗ đó.
VD:
Sub In()
i = 2
j = 20
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentWithMarkup, Copies:=1, Pages:="i,j", PageType:= _
wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
End sub
------------------
Cảm ơn các bác nhiều.
 
Bạn thử thay 2,20 bằng 2-20 xem thế nào

Xin lỗi. Hình như hiểu sai ý bạn
 
Lần chỉnh sửa cuối:
Web KT
Back
Top Bottom