Hi,
to loop through the files in a folder you can use the Dir function:
Code:
strFile = Dir(strfolder & "\PO*.pdf")
Do While Len(strFile) > 0
[here you can test on the indication Job completed and move the file if job completed]
strFile = Dir()
Loop
To move/rename the file you can use the Scripting.FileSystemObject. Example strFile = path + name of existing file, strLoc = new path + filename:
Code:
Public Function MoveFile(strFile As String, strLoc As String) As Boolean
On Error GoTo Err_MoveFile
Dim fsoImport As Object
Dim floImportFile As Object
Set fsoImport = CreateObject("Scripting.FileSystemObject")
Set floImportFile = fsoImport.GetFile(strFile)
If strFile <> strLoc Then
floImportFile.Move strLoc
End If
MoveFile = True
Exit_MoveFile:
Set fsoImport = Nothing
Set floImportFile = Nothing
Exit Function
Err_MoveFile:
MoveFile = False
Debug.Print Err.Number & ": " & Err.Description
Resume Exit_MoveFile
End Function