MikeAngelastro
Registered User.
- Local time
- Yesterday, 21:34
- Joined
- Mar 3, 2000
- Messages
- 254
Hi,
I am importing files that I want to move to another folder after the import is complete. I tried the MoveFile method and I get an error 70 for permission denied. I then tried the CopyFile method with the idea of deleting the file after the copy. The copy works but the delete doesn't and throws the same error. Anyone have any idea why? The code I am using is below.
Dim fs As New FileSystemObject
'Move imported file to the imported file folder.
Source = FileName
Destination = IMPORTED_PO_FOLDER & Dir$(FileName)
'This works.
fs.CopyFile Source, Destination
'This does not work - error: 70 - Permission denied.
'The FileExists works.
If fs.FileExists(Destination) Then fs.DeleteFile (Source)
'This does not work - error: 70 - Permission denied.
fs.MoveFile Source, Destination
Thanks,
Mike
I am importing files that I want to move to another folder after the import is complete. I tried the MoveFile method and I get an error 70 for permission denied. I then tried the CopyFile method with the idea of deleting the file after the copy. The copy works but the delete doesn't and throws the same error. Anyone have any idea why? The code I am using is below.
Dim fs As New FileSystemObject
'Move imported file to the imported file folder.
Source = FileName
Destination = IMPORTED_PO_FOLDER & Dir$(FileName)
'This works.
fs.CopyFile Source, Destination
'This does not work - error: 70 - Permission denied.
'The FileExists works.
If fs.FileExists(Destination) Then fs.DeleteFile (Source)
'This does not work - error: 70 - Permission denied.
fs.MoveFile Source, Destination
Thanks,
Mike