Please help me improve a process if you can.  With Thom’s help we got a script going that checks a folder and processes the documents within that folder.  I have the script checking the contents of that folder every 5 mins. When it sees documents in the folder, it processes them.  The order in which it processes the documents is alphabetical.  Is there anyway to have the script process the documents according to modify date?

 

Below is the part relevant part of our script.

Thanks!

 

Paul Brungardt

Clinical Analyst

HaysMedicalCenter

PH: 785-623-2196

 

_____________________________________________________________________________

Sub Open_Folder(Optional dummy As String)

Pause "Enter/Edit Visit/Note [EMAIL PROTECTED],1"

loopFiles "O:\private\EAR_new\", "O:\private\EAR_new\Done\", "O:\private\EAR_new\Errors\"

End Sub

________________________________________________________________________________

Sub loopFiles(Directory As String, ArchiveDirectory As String, ErrorDirectory As String)

 

Dim myDestinationPath, newFileName, myfile As String

Set fso = CreateObject("Scripting.FileSystemObject")

Set mainfolder = fso.GetFolder(Directory)

Set filecollection = mainfolder.Files

For Each File In filecollection

myfile = File.Name

'**************************************************************

' This is now a standard DataStation file process loop

' Modify as needed to add Status information, error handling etc

'**************************************************************

OpenFile mainfolder & "\" & File.Name

'***************************************************************

   If badfile Then

   fso.movefile mainfolder & "\" & myfile, ErrorDirectory & myfile

    Else

    fso.movefile mainfolder & "\" & myfile, ArchiveDirectory & myfile

End If

 Kill mainfolder & "\" & myfile & ".bds"

Next

End Sub

___________________________________________________________________________________

 

Reply via email to