Có.
1/ Mở trình điều khiển máy in lên xem;
2/ (hoặc) Bản in chui hết ra khỏi máy in tức là in xong.
Gửi khúc code đó lên đây.
Mấy chữ "dờ cờ" là dòng điện một chiều đó hả?
Đoạn code của em đây ạ:
Public num_of_row As Integer
Public ten1, ten2, tenfilepdf, tenfileexcel As String
-------------------------------------------------
Sub taoFILE()
Dim objfso As Object
Dim objfolder As Object
Dim objfile As Object
Dim i, j, n As Integer
Dim DD, ten1, ten2, tenfilepdf, tenfileexcel As String
Dim wb As Workbook
DD = Cells(3, 2).Text
Set objfso = CreateObject("scripting.filesystemobject")
Set objfolder = objfso.getfolder(DD)
For Each objfile In objfolder.Files
If objfile.Type = "Adobe Acrobat Document" Then
Cells(i + 7, 2) = objfile.Name
i = i + 1
Else
End If
If objfile.Type = "Microsoft Excel 97-2003 Worksheet" Then
Cells(j + 7, 3) = objfile.Name
j = j + 1
Else
End If
Next
num_of_row = Cells(Rows.Count, "B").End(xlUp).Row - 6
For l = 1 To num_of_row
Cells(l + 6, 4) = "=MID(B" & (l + 6) & ",SEARCH(" & 30 & ",B" & (l + 6) & "),12)"
Cells(l + 6, 5) = "=MID(C" & (l + 6) & ",SEARCH(" & 30 & ",C" & (l + 6) & "),12)"
Next
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _
("D6"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range(Cells(7, 2), Cells(num_of_row + 7, 2)).Copy
Cells(num_of_row + 15, 8).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort.SortFields.Add Key:=Range _
("E6"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range(Cells(7, 3), Cells(num_of_row + 7, 3)).Copy
Cells(num_of_row + 15, 9).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
------------------------------
Sub inPDF()
Dim k As Integer
For k = 1 To num_of_row
tenfilepdf = Cells(3, 2).Text & Application.PathSeparator & Cells(k + num_of_row + 14, 8).Text
With CreateObject("Shell.Application")
For n = 1 To 2
.Namespace(0).ParseName(tenfilepdf).InvokeVerb ("Print")
Next
End With
Application.Wait (Now + 3 / 24 / 60 / 60)
Cells(k, "F") = "DONE!"
Next
Application.Wait (Now + 3 / 24 / 60 / 60)
MsgBox "Da in xong"
End Sub
--------------------------
Sub inExcel()
Dim e As Integer
For e = 1 To num_of_row
tenfileexcel = Cells(3, 2).Text & Application.PathSeparator & Cells(e + num_of_row + 14, 9).Text
ten2 = Cells(e + num_of_row + 14, 9).Text
Workbooks.Open Filename:=tenfileexcel
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2, Copies:=2, Collate _
:=True, IgnorePrintAreas:=False
Workbooks(ten2).Close
Application.Wait (Now + 2 / 24 / 60 / 60)
Cells(e, "G") = "DONE!"
Next
MsgBox "Da in xong"
End Sub