The code im using to loop is as follows sorry trying to do this from my phone and not sure how to add code.
Do Until num = itemNum
num1 = InStr(1, UCase(Me.Controls("TextBox" & num).Text), ".PDF")
If num1 <> 0 Then
flag = 1
strDir = folder
strFile = Me.Controls("TextBox" & num).Text
If Me.Controls("chBox" & num).Value = True Then
printThis = PrintThisDoc(0, strDir & "\" & strFile)
Application.Wait (Now + TimeValue("0:00:05"))
Me.Controls("TextBox" & num).BackColor = VBGreen
Else
Me.Controls("TextBox" & num).BackColor = VBRed
End if
End If
num = num + 1
loop
within a module I have this code to print
Public Function PrintThisDoc(forname As Long, FileName As String)
On Error Resume Next
Dim X As Long
X = ShellExecute(forname, "Print", FileName, 0&, 0&, 3)
End Function
As I said all TextBoxes change colour after the code has completed not after every 5 second delay.
Bookmarks