1
인쇄 할 문서의 일일 목록을 확인하고 매 시간마다 확인하는 인쇄 시스템을 개발하고 싶습니다.VBA : 프린터 목록
지금까지 하나의 문서를 인쇄 할 수 있었지만 시간이 더 많이 인쇄되면 첫 번째 코드 만 작동합니다.
Sub printTag()
Dim strCommand As String
Dim filePath As String
Dim FileName As String
Dim printer As String
Dim numRefs As Integer
Dim x As Integer
Dim ref As String
Dim numFiles As Integer
Dim t As Integer
Dim difD As Long
Dim difH As Long
Dim difM As Long
Dim listDate As Date
Dim nowDate As Date
nowDate = ThisWorkbook.Sheets("Print").Range("B8")
printer = ThisWorkbook.Sheets("Print").Range("B2")
numRefs = WorksheetFunction.CountA(ThisWorkbook.Sheets("List").Columns("A"))
numFiles = WorksheetFunction.CountA(ThisWorkbook.Sheets("Relation").Columns("A"))
For x = 1 To numRefs
On Error Resume Next
listDate = ThisWorkbook.Sheets("List").Range("A" & x)
difD = DateDiff("d", nowDate, listDate)
If difD = 0 Then
difH = DateDiff("h", nowDate, listDate)
difM = DateDiff("n", nowDate, listDate)
If difH = 0 Then
If difM >= 0 Then
For t = 1 To numFiles
If ThisWorkbook.Sheets("List").Range("B" & x) = ThisWorkbook.Sheets("Relation").Range("A" & t) Then
filePath = ThisWorkbook.Sheets("Print").Range("B1") & "\" & ThisWorkbook.Sheets("Relation").Range("B" & t)
ThisWorkbook.Sheets("Print").Range("B3") = strCommand
strCommand = "PRINT " & filePath & "/D:" & printer
Shell strCommand, 1
End If
Next t
End If
End If
End If
Next x
End Sub