I usually use something like this:
Dim objFSO As Variant
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(c:\MyDocuments\Kronos.txt") Then
objFSO.MoveFile "c:\MyDocuments\Kronos.txt", "c:\Processed\"
End If
It looks like you want to move a file, not copy it. If you want to copy it then do this instead of MoveFile:
objFSO.CopyFile "c:\MyDocuments\*Kronos.txt", "c:\Processed\Kronos.txt"
If you are searching for a file and are using a wildcard, what you need to do is take the filename, and then check the Right(sFileName, 10) = "Kronos.txt"
Then do this:
objFSO.MoveFile "c:\MyDocuments\" & sFileName, "c:\Processed\"
Did that help?
mmcdonal
|